Hi, I'm trying to understand how the USB Mass Storage Device works in 2.6. Specifically 2.6.14. I see a fair amount of churn in this subsystem.
My principle concern/question is how does data from a file on the filesystem get transported to a memory stick? I have dumped info at many stages and see varying URB buffers sent out. My device is using PIO not DMA. The HCD controller understands this, but under hcd_alloc_buffer it choses to simply kmalloc what the Usb Mass Storage device asks for. This happens to be 64bytes as per: ----------------------------- * We provide a DMA-mapped I/O buffer for use with small USB transfers. * It turns out that CB[I] needs a 12-byte buffer and Bulk-only needs a * 31-byte buffer. But Freecom needs a 64-byte buffer, so that's the * size we'll allocate. ----------------------------- As I try to trace through the use of this, I see that the following flags are changing depending on various SCSI activity to the memory stick: ----------------------------- # pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef7084e8 TxFlags:0x5 TxBuff:0xc240a098 of 36 bytes [0x00 0x00 0x00 0x00...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] Vendor: USB Model: Flash Disk Rev: 2.00 Type: Direct-Access ANSI SCSI revision: 02 pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef7084e8 TxFlags:0x5 TxBuff:0xefbee03c of 8 bytes [0x00 0x00 0x00 0x00...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] SCSI device sdb: 127840 512-byte hdwr sectors (65 MB) pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef7084e8 TxFlags:0x5 TxBuff:0xefbee03c of 192 bytes [0x00 0x00 0x00 0x00...] drivers/usb/pehcd/host/pehci.c: ISP1761 HCD: Error - SHORT-READ-NOT-OK : length 12 (expected 192) ATL: IN PAYLOAD DATA from 0x00001100 to 0xefbee03c (12) [0b 00 00 08...] (URB_SHORT_NOT_OK) 0x0b, 0x00, 0x00, 0x08 0x00, 0x03, 0xe3, 0x11 0x00, 0x00, 0x08, 0x00 pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] sdb: Write Protect is off sdb: assuming drive cache: write through pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef7084e8 TxFlags:0x5 TxBuff:0xefbee03c of 8 bytes [0x00 0x00 0x00 0x00...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] SCSI device sdb: 127840 512-byte hdwr sectors (65 MB) pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef7084e8 TxFlags:0x5 TxBuff:0xefbee03c of 192 bytes [0x00 0x00 0x00 0x00...] drivers/usb/pehcd/host/pehci.c: ISP1761 HCD: Error - SHORT-READ-NOT-OK : length 12 (expected 192) ATL: IN PAYLOAD DATA from 0x00001100 to 0xefbee03c (12) [0b 00 00 08...] (URB_SHORT_NOT_OK) 0x0b, 0x00, 0x00, 0x08 0x00, 0x03, 0xe3, 0x11 0x00, 0x00, 0x08, 0x00 ..... ----------------------------- When I actually transfer file contents, I see the buffer sizes increase dramaitcally: ----------------------------- pehci urb_enqueue: URB:0xef7080b0 TxFlags:0x5 TxBuff:0xc2a40000 of 20480 bytes [0x33 0xcd 0xa9 0x71...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef70811c TxFlags:0x5 TxBuff:0xc2a45000 of 36864 bytes [0xef 0xd0 0xa3 0x42...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef70811c TxFlags:0x5 TxBuff:0xefa46800 of 512 bytes [0x00 0x00 0x00 0x00...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef70811c TxFlags:0x5 TxBuff:0xefa46a00 of 512 bytes [0x00 0x00 0x00 0x00...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 13 bytes [0x55 0x53 0x42 0x43...] pehci urb_enqueue: URB:0xef708338 TxFlags:0xc TxBuff:0xee110000 of 31 bytes [0x55 0x53 0x42 0x43...] I'm curious how the TxFlags keep changing... these are combinations of: ----------------------------- #define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ #define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ #define URB_NO_FSBR 0x0020 /* UHCI-specific */ #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ ----------------------------- I only see the flags non-zero once the SCSI system start discoverying the memorystick. Previous URB enqueues are all zero for the most part. My present situation is that after transfering files I see file contents that are corrupt, along with system instability. I'm trying to isolate if I'm indeed copying correclty to and from memory. I see DMA-based HCDs use pools of data. For non DMA based HCDs I see accomodations have been made in teh hcd.c allocation system. But wonder if the SCSI USB Mass Storage device works with this in mind? I would also like to figure out if/why the flags for DMA transfers are fluctuating so much... and specifically the logic behind this snippet: ----------------------------- /* we assume that if transfer_buffer isn't us->iobuf then it * hasn't been mapped for DMA. Yes, this is clunky, but it's * easier than always having the caller tell us whether the * transfer buffer has already been mapped. */ us->current_urb->transfer_flags = URB_NO_SETUP_DMA_MAP; if (us->current_urb->transfer_buffer == us->iobuf) us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; us->current_urb->transfer_dma = us->iobuf_dma; us->current_urb->setup_dma = us->cr_dma; ----------------------------- I'm missing something here... I'm just trying to figure out where I SHOULD be reading & writing from in memory as I'm presently not and its blowing up whenever the SCSI system notices my memory stick. Any help much appreciated. Mike. ____________________________________________________________________________________ Food fight? Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A. http://answers.yahoo.com/dir/?link=list&sid=396545367 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel