diff options
-rw-r--r-- | board/elm/usb_pd_policy.c | 16 | ||||
-rw-r--r-- | board/glados/usb_pd_policy.c | 16 | ||||
-rw-r--r-- | board/kevin/usb_pd_policy.c | 16 | ||||
-rw-r--r-- | board/oak/usb_pd_policy.c | 16 | ||||
-rw-r--r-- | board/reef/usb_pd_policy.c | 16 |
5 files changed, 75 insertions, 5 deletions
diff --git a/board/elm/usb_pd_policy.c b/board/elm/usb_pd_policy.c index 05cfe97e0b..b03d52e71e 100644 --- a/board/elm/usb_pd_policy.c +++ b/board/elm/usb_pd_policy.c @@ -168,7 +168,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); uint16_t dev_id = 0; - int is_rw; + int is_rw, is_latest; /* make sure we have some payload */ if (cnt == 0) @@ -187,6 +187,20 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, dev_id = VDO_INFO_HW_DEV_ID(payload[6]); is_rw = VDO_INFO_IS_RW(payload[6]); + is_latest = pd_dev_store_rw_hash(port, + dev_id, + payload + 1, + is_rw ? + SYSTEM_IMAGE_RW : + SYSTEM_IMAGE_RO); + + /* + * Send update host event unless our RW hash is + * already known to be the latest update RW. + */ + if (!is_rw || !is_latest) + pd_send_host_event(PD_EVENT_UPDATE_DEVICE); + CPRINTF("DevId:%d.%d SW:%d RW:%d\n", HW_DEV_ID_MAJ(dev_id), HW_DEV_ID_MIN(dev_id), diff --git a/board/glados/usb_pd_policy.c b/board/glados/usb_pd_policy.c index 77aa25a8e3..9e25021328 100644 --- a/board/glados/usb_pd_policy.c +++ b/board/glados/usb_pd_policy.c @@ -170,7 +170,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); uint16_t dev_id = 0; - int is_rw; + int is_rw, is_latest; /* make sure we have some payload */ if (cnt == 0) @@ -189,6 +189,20 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, dev_id = VDO_INFO_HW_DEV_ID(payload[6]); is_rw = VDO_INFO_IS_RW(payload[6]); + is_latest = pd_dev_store_rw_hash(port, + dev_id, + payload + 1, + is_rw ? + SYSTEM_IMAGE_RW : + SYSTEM_IMAGE_RO); + + /* + * Send update host event unless our RW hash is + * already known to be the latest update RW. + */ + if (!is_rw || !is_latest) + pd_send_host_event(PD_EVENT_UPDATE_DEVICE); + CPRINTF("DevId:%d.%d SW:%d RW:%d\n", HW_DEV_ID_MAJ(dev_id), HW_DEV_ID_MIN(dev_id), diff --git a/board/kevin/usb_pd_policy.c b/board/kevin/usb_pd_policy.c index fc55737037..a880b1375f 100644 --- a/board/kevin/usb_pd_policy.c +++ b/board/kevin/usb_pd_policy.c @@ -186,7 +186,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); uint16_t dev_id = 0; - int is_rw; + int is_rw, is_latest; /* make sure we have some payload */ if (cnt == 0) @@ -205,6 +205,20 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, dev_id = VDO_INFO_HW_DEV_ID(payload[6]); is_rw = VDO_INFO_IS_RW(payload[6]); + is_latest = pd_dev_store_rw_hash(port, + dev_id, + payload + 1, + is_rw ? + SYSTEM_IMAGE_RW : + SYSTEM_IMAGE_RO); + + /* + * Send update host event unless our RW hash is + * already known to be the latest update RW. + */ + if (!is_rw || !is_latest) + pd_send_host_event(PD_EVENT_UPDATE_DEVICE); + CPRINTF("DevId:%d.%d SW:%d RW:%d\n", HW_DEV_ID_MAJ(dev_id), HW_DEV_ID_MIN(dev_id), diff --git a/board/oak/usb_pd_policy.c b/board/oak/usb_pd_policy.c index 458b6dcb90..357afabd8f 100644 --- a/board/oak/usb_pd_policy.c +++ b/board/oak/usb_pd_policy.c @@ -181,7 +181,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); uint16_t dev_id = 0; - int is_rw; + int is_rw, is_latest; /* make sure we have some payload */ if (cnt == 0) @@ -200,6 +200,20 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, dev_id = VDO_INFO_HW_DEV_ID(payload[6]); is_rw = VDO_INFO_IS_RW(payload[6]); + is_latest = pd_dev_store_rw_hash(port, + dev_id, + payload + 1, + is_rw ? + SYSTEM_IMAGE_RW : + SYSTEM_IMAGE_RO); + + /* + * Send update host event unless our RW hash is + * already known to be the latest update RW. + */ + if (!is_rw || !is_latest) + pd_send_host_event(PD_EVENT_UPDATE_DEVICE); + CPRINTF("DevId:%d.%d SW:%d RW:%d\n", HW_DEV_ID_MAJ(dev_id), HW_DEV_ID_MIN(dev_id), diff --git a/board/reef/usb_pd_policy.c b/board/reef/usb_pd_policy.c index 4a1fb78a74..880a6bd06f 100644 --- a/board/reef/usb_pd_policy.c +++ b/board/reef/usb_pd_policy.c @@ -183,7 +183,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); uint16_t dev_id = 0; - int is_rw; + int is_rw, is_latest; /* make sure we have some payload */ if (cnt == 0) @@ -202,6 +202,20 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, dev_id = VDO_INFO_HW_DEV_ID(payload[6]); is_rw = VDO_INFO_IS_RW(payload[6]); + is_latest = pd_dev_store_rw_hash(port, + dev_id, + payload + 1, + is_rw ? + SYSTEM_IMAGE_RW : + SYSTEM_IMAGE_RO); + + /* + * Send update host event unless our RW hash is + * already known to be the latest update RW. + */ + if (!is_rw || !is_latest) + pd_send_host_event(PD_EVENT_UPDATE_DEVICE); + CPRINTF("DevId:%d.%d SW:%d RW:%d\n", HW_DEV_ID_MAJ(dev_id), HW_DEV_ID_MIN(dev_id), |