diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-07-27 14:36:53 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-28 21:31:38 +0000 |
commit | a9527fd686dcdd0b04c4eac6690531d945e7f221 (patch) | |
tree | b094ce4302d22dcff233e9738fc71105f70adaca /common/charge_state_v2.c | |
parent | 0183e3cc7ffc507bbb3fc7d4165b3b13a90b813e (diff) | |
download | chrome-ec-a9527fd686dcdd0b04c4eac6690531d945e7f221.tar.gz |
acpi: Ensure continuity of memmap data with a read cache
For multi-byte ACPI memmap reads, we previously had a mutex to ensure
data continuity. A better approach is to use a read cache. Since the
kernel will enable burst mode before reading a multi-byte memmap
variable and disable it afterward, we can populate the cache on the
first read after enabling burst. This solution removes deadlock bugs, is
contained entirely in acpi.c, and saves a deferred function.
BUG=chromium:514283
TEST=Manual on Glados. Add prints in acpi_read, verify that multi-byte
reads come from cache and non-burst reads continue to function as
before.
BRANCH=Cyan
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I74e4927bf2b433e31a9ff65d72820fa087c51722
Reviewed-on: https://chromium-review.googlesource.com/288871
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/charge_state_v2.c')
-rw-r--r-- | common/charge_state_v2.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index d588ae3362..0ca0974739 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -124,12 +124,6 @@ static int update_static_battery_info(void) */ int rv; - /* - * We're updating multi-byte memmap vars, don't allow ACPI to do - * reads while we're updating. - */ - host_lock_memmap(); - /* Smart battery serial number is 16 bits */ batt_str = (char *)host_get_memmap(EC_MEMMAP_BATT_SERIAL); memset(batt_str, 0, EC_MEMMAP_TEXT_MAX); @@ -173,9 +167,6 @@ static int update_static_battery_info(void) *(int *)host_get_memmap(EC_MEMMAP_BATT_LFCC) = 0; *host_get_memmap(EC_MEMMAP_BATT_FLAG) = 0; - /* No more multi-byte memmap writes. */ - host_unlock_memmap(); - if (rv) problem(PR_STATIC_UPDATE, rv); else @@ -220,12 +211,6 @@ static void update_dynamic_battery_info(void) batt_present = 0; } - /* - * We're updating multi-byte memmap vars, don't allow ACPI to do - * reads while we're updating. - */ - host_lock_memmap(); - if (!(curr.batt.flags & BATT_FLAG_BAD_VOLTAGE)) *memmap_volt = curr.batt.voltage; @@ -252,9 +237,6 @@ static void update_dynamic_battery_info(void) send_batt_info_event++; } - /* No more multi-byte memmap writes. */ - host_unlock_memmap(); - if (curr.batt.is_present == BP_YES && !(curr.batt.flags & BATT_FLAG_BAD_STATE_OF_CHARGE) && curr.batt.state_of_charge <= BATTERY_LEVEL_CRITICAL) |