From ac78e589af2fd74c36b570130dd0dde03f35e572 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Fri, 19 Jul 2013 14:00:51 -0700 Subject: Add new hostevents to ask the AP to throttle itself Occasionally the EC wants to ask the AP to throttle itself. Currently, the only thing that the EC can do (at least on x86) is to assert the PROCHOT# signal, which is a fairly intrusive operation and one that Intel suggests we save for emergencies. This CL adds a new pair of host events to ask the BIOS to throttle the AP politely, or stop doing so. The turbo charger code will send these events to the AP if they become necessary. BUG=chrome-os-partner:20739 BRANCH=falco,peppy TEST=manual Tests should still pass, everything else is unchanged. make BOARD=${BOARD} runtests Currently, there's nothing on the BIOS/OS side that would respond to these events, so they're just ignored. You can test that, even without this CL, by running hostevent set 0x40000 hostevent set 0x80000 Change-Id: I4a7a1b6eb87e42df94ddd09f4c6abee6ebcbd485 Signed-off-by: Bill Richardson Reviewed-on: https://gerrit.chromium.org/gerrit/63379 Reviewed-by: Aaron Durbin --- common/extpower_falco.c | 10 ++++++++++ include/ec_commands.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/common/extpower_falco.c b/common/extpower_falco.c index dec406703b..4f2daedeaf 100644 --- a/common/extpower_falco.c +++ b/common/extpower_falco.c @@ -185,9 +185,19 @@ bad: CPRINTF("[%T ERROR: can't talk to charger: %d]\n", r); } +/* FIXME: There's already a chipset_throttle_cpu() function. However, it's a + * fairly large hammer - on x86, it just asserts PROCHOT. That's less than + * ideal for the turbo boost charger stuff. We might want to make this + * function generic enough to use from other places. For now, meh. */ test_export_static int ap_is_throttled; static void set_throttle(int on) { + if (on) + host_set_events(EC_HOST_EVENT_MASK( + EC_HOST_EVENT_THROTTLE_START)); + else + host_set_events(EC_HOST_EVENT_MASK( + EC_HOST_EVENT_THROTTLE_STOP)); ap_is_throttled = on; } diff --git a/include/ec_commands.h b/include/ec_commands.h index de1d9a870a..b9d3a8a2f7 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -243,6 +243,11 @@ enum host_event_code { /* Shutdown due to battery level too low */ EC_HOST_EVENT_BATTERY_SHUTDOWN = 17, + /* Suggest that the AP throttle itself */ + EC_HOST_EVENT_THROTTLE_START = 18, + /* Suggest that the AP resume normal speed */ + EC_HOST_EVENT_THROTTLE_STOP = 19, + /* * The high bit of the event mask is not used as a host event code. If * it reads back as set, then the entire event mask should be -- cgit v1.2.1