diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-02-16 14:26:46 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-02-24 15:23:24 -0800 |
commit | f0b564b4a031fdc974a98a13308a62a460ae4a69 (patch) | |
tree | 4a98eb323e3771fb38f575462fd83fbe2a13ce1a /common | |
parent | fb8e36631af8395d45d3bef79822c03dd6298ca3 (diff) | |
download | chrome-ec-f0b564b4a031fdc974a98a13308a62a460ae4a69.tar.gz |
system: Add generic bbram read / write routines
Add generic routines to read or write a byte to battery-backed RAM, and
implement vbnvcontext get/set using these routines.
BUG=chrome-os-partner:62952
BRANCH=reef
TEST=On reef, with subsequent commit, run "cutoff" on the console,
reattach AC, and verify device successfully wakes. Also verify Rp is
dropped on console 'reboot' and F3 + power from RW.
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I14691923f2e5198e901b6b5199e92c58c68cd18d
Reviewed-on: https://chromium-review.googlesource.com/444444
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/system.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/common/system.c b/common/system.c index 25acdbf544..a5824f0a72 100644 --- a/common/system.c +++ b/common/system.c @@ -1227,17 +1227,22 @@ int host_command_vbnvcontext(struct host_cmd_handler_args *args) { const struct ec_params_vbnvcontext *p = args->params; struct ec_response_vbnvcontext *r; + int i; switch (p->op) { case EC_VBNV_CONTEXT_OP_READ: r = args->response; - if (system_get_vbnvcontext(r->block)) - return EC_RES_ERROR; + for (i = 0; i < EC_VBNV_BLOCK_SIZE; ++i) + if (system_get_bbram(SYSTEM_BBRAM_IDX_VBNVBLOCK0 + i, + r->block + i)) + return EC_RES_ERROR; args->response_size = sizeof(*r); break; case EC_VBNV_CONTEXT_OP_WRITE: - if (system_set_vbnvcontext(p->block)) - return EC_RES_ERROR; + for (i = 0; i < EC_VBNV_BLOCK_SIZE; ++i) + if (system_set_bbram(SYSTEM_BBRAM_IDX_VBNVBLOCK0 + i, + p->block[i])) + return EC_RES_ERROR; break; default: return EC_RES_ERROR; |