diff options
author | Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> | 2021-09-02 20:05:56 +0530 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-20 16:50:23 +0000 |
commit | 438f1748043d9b9869a8986ac06208e0102554a8 (patch) | |
tree | 58e8107321656bd22deef4a3c7baaeffa2a4a1cb /common/usb_pd_console_cmd.c | |
parent | c1ef7c696c45632503165cbabb1e37cbabfbe448 (diff) | |
download | chrome-ec-438f1748043d9b9869a8986ac06208e0102554a8.tar.gz |
usbpd: implement new api to access PD discovery data
API pd_get_am_discovery() sets the lock (task access bit) to keep track
of EC tasks accessing the pd port discovery data. If any of the task
access bits are set,EC host task typec discovery handler will return
EC_RES_BUSY to host, indicating discovery data is modified while copying
port discovery data to the host. Hence the lock/task access bit should
be set only when the port discovery data is modified by any tasks.
Setting of lock/task access is removed from pd_get_am_discovery() and
implemented new api pd_get_am_discovery_and_notify_access() for this.
pd_get_am_discovery() proto type is changed to return 'constant pointer'
which forces developers to use pd_get_am_discovery_and_notify_access()
when they intend to access and modify discovery data.
summary of changes implemented.
- Remove setting of task access bit from pd_get_am_discovery().
- modify pd_get_am_discovery() prototype to return constant pointer.
- implement new api pd_get_am_discovery_and_notify_access()
- Replace calls to pd_get_am_discovery() with new api
wherever discovery data is accessed and modified.
BRANCH=none
BUG=b:197466819 b:190390784
TEST=Verified 50 cold boot cycling with TBT device attached.
Device detected in every cycle.
Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com>
Change-Id: I5b6f1f2b91d92ddbe58f3bf994f684abee948c02
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139858
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common/usb_pd_console_cmd.c')
-rw-r--r-- | common/usb_pd_console_cmd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/usb_pd_console_cmd.c b/common/usb_pd_console_cmd.c index 984f9def91..3ad1944494 100644 --- a/common/usb_pd_console_cmd.c +++ b/common/usb_pd_console_cmd.c @@ -112,7 +112,7 @@ static int command_cable(int argc, char **argv) { int port; char *e; - struct pd_discovery *disc; + const struct pd_discovery *disc; enum idh_ptype ptype; int cable_rev; union tbt_mode_resp_cable cable_mode_resp; |