summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/fruitpie/usb_pd_policy.c8
-rw-r--r--board/ryu_p1/usb_pd_policy.c4
-rw-r--r--board/samus_pd/usb_pd_policy.c4
-rw-r--r--common/usb_pd_protocol.c3
-rw-r--r--include/usb_pd.h3
-rw-r--r--util/ectool.c5
6 files changed, 19 insertions, 8 deletions
diff --git a/board/fruitpie/usb_pd_policy.c b/board/fruitpie/usb_pd_policy.c
index 52adce5677..0958781422 100644
--- a/board/fruitpie/usb_pd_policy.c
+++ b/board/fruitpie/usb_pd_policy.c
@@ -198,9 +198,11 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload,
/* if last word is present, it contains lots of info */
if (cnt == 7) {
dev_id = VDO_INFO_HW_DEV_ID(payload[6]);
- CPRINTF("Dev:0x%04x SW:%d RW:%d\n", dev_id,
- VDO_INFO_SW_DBG_VER(payload[6]),
- VDO_INFO_IS_RW(payload[6]));
+ CPRINTF("DevId:%d.%d SW:%d RW:%d\n",
+ HW_DEV_ID_MAJ(dev_id),
+ HW_DEV_ID_MIN(dev_id),
+ VDO_INFO_SW_DBG_VER(payload[6]),
+ VDO_INFO_IS_RW(payload[6]));
}
/* copy hash */
if (cnt >= 6)
diff --git a/board/ryu_p1/usb_pd_policy.c b/board/ryu_p1/usb_pd_policy.c
index d98d17c11c..918e4305c6 100644
--- a/board/ryu_p1/usb_pd_policy.c
+++ b/board/ryu_p1/usb_pd_policy.c
@@ -210,7 +210,9 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload,
if (cnt == 7) {
/* TODO: Notify host */
dev_id = VDO_INFO_HW_DEV_ID(payload[6]);
- CPRINTF("Dev:0x%04x SW:%d RW:%d\n", dev_id,
+ CPRINTF("DevId:%d.%d SW:%d RW:%d\n",
+ HW_DEV_ID_MAJ(dev_id),
+ HW_DEV_ID_MIN(dev_id),
VDO_INFO_SW_DBG_VER(payload[6]),
VDO_INFO_IS_RW(payload[6]));
}
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index b87c880ded..8646433734 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -268,7 +268,9 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload,
pd_dev_store_rw_hash(port, dev_id, payload + 1);
pd_send_host_event(PD_EVENT_UPDATE_DEVICE);
- CPRINTF("Dev:0x%04x SW:%d RW:%d\n", dev_id,
+ CPRINTF("DevId:%d.%d SW:%d RW:%d\n",
+ HW_DEV_ID_MAJ(dev_id),
+ HW_DEV_ID_MIN(dev_id),
VDO_INFO_SW_DBG_VER(payload[6]),
VDO_INFO_IS_RW(payload[6]));
} else if (cnt == 6) {
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 525ee732e7..b8783161db 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1305,7 +1305,8 @@ static void pd_vdm_send_state_machine(int port)
static inline void pd_dev_dump_info(uint16_t dev_id, uint8_t *hash)
{
int j;
- ccprintf("Device:0x%04x Hash:", dev_id);
+ ccprintf("DevId:%d.%d Hash:", HW_DEV_ID_MAJ(dev_id),
+ HW_DEV_ID_MIN(dev_id));
for (j = 0; j < PD_RW_HASH_SIZE; j += 4) {
ccprintf(" 0x%02x%02x%02x%02x", hash[j + 3], hash[j + 2],
hash[j + 1], hash[j]);
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 38ae017c8b..9fbfc19ebf 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -503,6 +503,9 @@ struct pd_policy {
#define VDO_INFO_SW_DBG_VER(x) (((x) >> 1) & 0x7fff)
#define VDO_INFO_IS_RW(x) ((x) & 1)
+#define HW_DEV_ID_MAJ(x) (x & 0x3ff)
+#define HW_DEV_ID_MIN(x) ((x) >> 10)
+
/* USB-IF SIDs */
#define USB_SID_PD 0xff00 /* power delivery */
#define USB_SID_DISPLAYPORT 0xff01
diff --git a/util/ectool.c b/util/ectool.c
index da16c8e3c4..6bbaab900f 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -861,9 +861,10 @@ int cmd_pd_device_info(int argc, char *argv[])
printf("Port:%d has no valid device\n", p->port);
else {
uint8_t *rwp = r0->dev_rw_hash;
- printf("Port:%d Device:%d Hash: ", p->port, r0->dev_id);
+ printf("Port:%d DevId:%d.%d Hash:", p->port,
+ HW_DEV_ID_MAJ(r0->dev_id), HW_DEV_ID_MIN(r0->dev_id));
for (i = 0; i < 5; i++) {
- printf(" 0x%02x%02x%02x%02x ", rwp[3], rwp[2], rwp[1],
+ printf(" 0x%02x%02x%02x%02x", rwp[3], rwp[2], rwp[1],
rwp[0]);
rwp += 4;
}