The commands in ectool.c look like this:
int cmd_foo(int argc, char *argv[]) { ... }
but unlike normal C convention, argv[0] is NOT the command. This change
makes argv[0] be the command name, so it's just like main().
BUG=chrome-os-partner:8748
TEST=manual
Run ectool as usual. You should see no difference in behavior.
Change-Id: Ia92784d46a287ab08f279f6255487817b620f200
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Add a host command returning chip information. The interface is in common/
while the implementations are in chip-specific code (note: added simple
value for stm).
BUG=chrome-os-partner:8567
TEST=on board
% ectool chipinfo
Chip info:
vendor: xx
name: yyyy
revision: zzzzz
Change-Id: I5030a03a6fcfbfc080d5acd8efb763fde7eefde5
This data is used to populate the _BIF/_BIX packages in ACPI
but it currently needs an EC command to retrieve that isn't
easy to query in ACPI since it isn't using standard EC RAM.
1) Export these additional fields in init() state:
- Design Capacity of Full
- Design Voltage
- Last Full Charge Capacity
- Cycle Count
- Manufacturer String
- Model String
- Serial Number String
2) Fix an issue where battery current was not reported when
the battery was charging.
3) Remove the command interface so there is no duplication.
BUG=chrome-os-partner:7734
TEST=using (not yet published) coreboot to read battery status
via ACPI and verify that battery removal/insertion events
are properly handled.
Change-Id: If337aad3255e5b1a0f85168838f1dd86a32bbeb3
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
BUG=chrome-os-partner:8728
TEST=manual
I don't have a system that has both an EC and a lightsaber, so I can't be
certain this works, but I *think* it will.
I do have a Link proto 0.5. With that, you can say
ectool lightbar test
and the EC console says it's poking at the lightbar, but of course there's
nothing there. If there was, it *should* flash in pretty colors. I have a
lightsaber attached to a BDS, and from the EC console running "lightsaber
test" does make it blink.
Change-Id: Ib6021ad8e53959de52b12efda376254071e5fb4b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
This reverts commit dfe22b2b1e.
We seem to have solved I2C block issue. Reverting the workaround LPC
command and ectool command.
Signed-off-by: Vic Yang <victoryang@google.com>
BUG=chrome-os-partner:8239
TEST=Compilation succeed. Manually tested temperature polling still
works.
Change-Id: I0acb567a138282479c7cc07cbfa723c439d04cd7
Group temperature sensors into different types so we only have to set
temperature threshold for each type instead of each sensor.
Signed-off-by: Vic Yang <victoryang@google.com>
BUG=chrome-os-partner:8466
TEST=Fan control still works.
Change-Id: I7acc714c32f282cec490b9e02d402ab91a53becf
Update test python scripts for recent trace modifications :
- lack of firmware B
- updated motd
Update QEMU to deal gracefully with various new registers accesses.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=make qemu-tests
Change-Id: I59a53822193b7377fe5f61f75c951b6cd24fc54b
This works similar to SCI/SMI events, but triggers a separate
level-sensitive signal to the PCH instead.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:8514
TEST=manual
From EC console:
gpioget PCH_WAKEn --> should be 1
hostevent wake 0x1
close lid switch (with magnet)
hostevent -> should show wake mask 0x1, raw events 0x1
gpioget PCH_WAKEn --> should be 0
hostevent clear 0x1
hostevent -> should show raw events 0
gpioget PCH_WAKEn --> should be 1
Change-Id: I29832c1dc30239a98987578f07dfeb25791dde11
Until we solve the I2C hanging issue, we need a reliable way to read
temperature. Add back LPC temperature read command that actually trigger
a I2C read.
Signed-off-by: Vic Yang <victoryang@google.com>
BUG=chrome-os-partner:8452,chrome-os-partner:8495
TEST=none
Change-Id: Icddd1fe3c1f09889bca633af19041a8aca582de9
Make temp sensor report 0xfd when sensor is unpowered.
Also refactor power specification of temp sensors from thermal.c to
temp_sensor.c.
Signed-off-by: Vic Yang <victoryang@google.com>
BUG=chrome-os-partner:8279
TEST=none
Change-Id: Ib13813bdbac2f048fbc3b98fae5bbf104ebf37d7
Note that this is a big security hole and should be removed after we
complete the EC autoupdate mechanism and vboot code.
To full update EC firmware on proto 1.0, we need a manual way to switch
EC running on RO/RW. This CL implements the LPC command.
BUG=chrome-os-partner:8415
TEST=on proto 0.5.
ectool reboot_ec RW_A # EC boots to RW A
ectool reboot_ec RO # EC boots to RO
Change-Id: Ibf050328bc4e3d2c6d72bfc478d6334f11f0eb46
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:8325
TEST=manual
Boot system with lid open. 'ectool switches' should show lid open.
Use 'dut-control goog_rec_mode:on'. 'ectool switches should show
dedicated recovery signal on.'
Use 'dut-control goog_rec_mode:off'. 'ectool switches should show
dedicated recovery signal off.'
Disable write protect via screw. 'ectool switches' should show WP
signal disabled.
Boot system in recovery mode (power+esc+reload). Should show 0x09.
Change-Id: I0434427c4b5f8c07c02a8714618f7eb101b86fed
The STM32L15xx monitor does not implement the mass erase,
so we need to use the page erase feature and loop.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=on Discovery, fill the flash with a pattern, then erase, write a
firmware image, read back the content of the flash, run the firmware.
Change-Id: Icf0e9812a5d491fea78472a0203ddbbc3e813b2f
Note that this only handles lid and power button; see
crosbug.com/p/8325 for write protect.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:8185
TEST=manual
1. Check state with lid open
localhost ~ # ectool switches
Current switches: 0x01
Lid switch: OPEN
Power button: UP
Write protect: ENABLED
2. Press power button
localhost ~ # ectool switches
Current switches: 0x03
Lid switch: OPEN
Power button: DOWN
Write protect: ENABLED
3. Release power button and close lid
localhost ~ # ectool switches
Current switches: 0x00
Lid switch: CLOSED
Power button: UP
Write protect: ENABLED
Change-Id: I25f2fa3dfeac004dde9b10a4243ee235875f1b6e
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
Fix the quoting for git local change detection.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=run ./util/getversion.sh on a repository with and without local
changes and observe we no longer have a spurious output on stderr.
Change-Id: I40ea4505d175c9135027ba7cf2b787c08eff6f70
The list of if()'s was getting long and obnoxious.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=none
TEST=run a few ectool commands and see that they still work
Change-Id: Ie292b50a27e98ca2c48f13e1141faf273efdd94b
'ectool temps 0' always have non-zero return code.
Signed-off-by: Vic Yang <victoryang@chromium.org>
BUG=chrome-os-partner:8294
TEST="ectool temps 0 && echo 'test'" gives 'test' on screen.
Change-Id: I3a4eff513638c25ec68e24968ce9d1022b4c1281
Add build information (date/time/builder) which can be displayed at the
EC console.
Generate a version from the board name and the branch tag.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chromium-os:27013
TEST=on BDS, run version command on the console.
inspect the built binary.
Change-Id: Idb1f68898ba6b811d02919f17ab4536ed9f8934a
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
Implement LPC commands and ectool commands to
1. Set/get threshold temperature values.
2. Toggle on/off automatic fan speed control.
Signed-off-by: Vic Yang <victoryang@chromium.org>
BUG=chrome-os-partner:8251
TEST=Manual test
Change-Id: Ia4282a6fa47a838aed26540f33c1eb7acc92ef0e
Add a task to update fan speed in LPC mapped memory once per second.
Also added read_mapped_mem16 and read_mapped_mem32.
Signed-off-by: Vic Yang <victoryang@chromium.org>
BUG=chrome-os-partner:8183
TEST="ectool pwmgetfanrpm" shows same result as "faninfo" from ec
console.
Change-Id: Ibc536acd39f836ffcad0bfa7c9c14e730220bd49
Add a task to update temperature values in LPC mapped value space every
second. Also modify ectool to read directly from LPC mapped space.
Signed-off-by: Vic Yang <victoryang@chromium.org>
BUG=chrome-os-partner:8065
TEST="ectool temps" gives same result as "temps" from ec console.
Change-Id: Idcdef8d822724f9bd22d7e819c717cba5af5eb77
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>
This will allow more efficient access to EC-provided data (temperature,
fan, battery) by the main processor.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:7857
TEST='ectool hello' from link main processor should still work
Change-Id: I2dc683f3441b34de9fb4debf772e386b9fdcfa82
When run with BOOT0=1 and BOOT1=0, the STM32L enters a system monitor
which allows flashing over the serial port (USART1 pins PA9 and PA10).
Implement commands to flash and run a program from a linux Host.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=on a serial port connected to Discovery board pins PA9 and PA10,
run manually the various tools commands.
Change-Id: I42f95ed50a56d82d728989149b3e47210af9dc96
Refactor board/chip-specific code into corresponding directories.
Add support of the four I2C temp sensor in Link.
Use table lookup to handle different types of temperature sensors.
BUG=chrome-os-partner:7527
TEST=Correctly read EC internal temperature on bds.
Compile for link succeeded.
Change-Id: I694cfa54e1545798d877fafdf18c5585ab5f03e2
Add an option to read temperature from only specified temperature
sensor. With this we can prevent ectool returning error if we already
know a sensor is not connected and do not want ectool to read it.
BUG=none
TEST=ectool temps; ectool temps temp_sensor_ec_internal
Change-Id: I221f1e3390d17f4a3ae99f58eb701a99c7b566b9
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
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
Macro _GNU_SOURCE is not automatically defined in chroot host toolchain.
Add this macro to let stdlib.h header file declare ptsname_r() function.
BUG=None
TEST=Run "gcc -V" to check if the toolchain version >= 4.6.0.
And run "make clean; make" in Chromium OS dev chroot.
Change-Id: I02d8a6f9ac9a6e51da3f2cd2ecbec9ec1f096c6a
Signed-off-by: Rong Chang <rongchang@chromium.org>
This provides a pty for the EC UART channel on the BD-ICDI-B FTDI
daughtercard for EC debugging.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=none
TEST=make && build/bds/util/ec_uartd (with EC attached to FTDI board)
Change-Id: I51fe50d0da6345962affb860b923425197a04fa1
re-compile the QEMU code, so it runs properly inside the chroot.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=make qemu-tests
Change-Id: Ib2a5d9aa56533fd6749c40eb8f73db955676886d
Build is the system doing the build (e.g. 64-bit linux) and host is the
target platform on top of the ec (e.g. 32-bit Chromium OS).
Necessary to get ectool properly compiling for Chromium OS.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=none
TEST=make && file build/bds/util/ectool; ectool should be a 32-bit binary
Change-Id: I50eba4c164ece236646a7c6087b1b86769beeb28