static void isp1362_read_ptd(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep, struct isp1362_ep_queue *epq) { struct ptd *ptd = &ep->ptd; int act_len; WARN_ON(list_empty(&ep->active)); BUG_ON(ep->ptd_offset < 0); list_del_init(&ep->active); DBG(1, "%s: ep %p removed from active list %p\n", __func__, ep, &epq->active); prefetchw(ptd); isp1362_read_buffer(isp1362_hcd, ptd, ep->ptd_offset, PTD_HEADER_SIZE); dump_ptd(ptd); act_len = PTD_GET_COUNT(ptd); if (PTD_GET_DIR(ptd) != PTD_DIR_IN || act_len == 0) return; if (act_len > ep->length) pr_err("%s: ep %p PTD $%04x act_len %d ep->length %d\n", __func__, ep, ep->ptd_offset, act_len, ep->length); BUG_ON(act_len > ep->length); /* Only transfer the amount of data that has actually been overwritten * in the chip buffer. We don't want any data that doesn't belong to the * transfer to leak out of the chip to the callers transfer buffer! */ prefetchw(ep->data); isp1362_read_buffer(isp1362_hcd, ep->data, ep->ptd_offset + PTD_HEADER_SIZE, act_len); dump_ptd_in_data(ptd, ep->data); }
/* Dump PTD info. The code documents the format perfectly, right :) */ static inline void dump_ptd(struct ptd *ptd) { #if defined(VERBOSE) int k; #endif DBG("PTD(ext) : cc:%x %d%c%d %d,%d,%d t:%x %x%x%x", PTD_GET_CC(ptd), PTD_GET_FA(ptd), PTD_DIR_STR(ptd), PTD_GET_EP(ptd), PTD_GET_COUNT(ptd), PTD_GET_LEN(ptd), PTD_GET_MPS(ptd), PTD_GET_TOGGLE(ptd), PTD_GET_ACTIVE(ptd), PTD_GET_SPD(ptd), PTD_GET_LAST(ptd)); #if defined(VERBOSE) printf("isp116x: %s: PTD(byte): ", __FUNCTION__); for (k = 0; k < sizeof(struct ptd); ++k) printf("%02x ", ((u8 *) ptd)[k]); printf("\n"); #endif }
static inline void dump_ptd_data(struct ptd *ptd, u8 * buf, int type) { #if defined(VERBOSE) int k; if (type == 0 /* 0ut data */ ) { printf("isp116x: %s: out data: ", __FUNCTION__); for (k = 0; k < PTD_GET_LEN(ptd); ++k) printf("%02x ", ((u8 *) buf)[k]); printf("\n"); } if (type == 1 /* 1n data */ ) { printf("isp116x: %s: in data: ", __FUNCTION__); for (k = 0; k < PTD_GET_COUNT(ptd); ++k) printf("%02x ", ((u8 *) buf)[k]); printf("\n"); } if (PTD_GET_LAST(ptd)) DBG("--- last PTD ---"); #endif }