Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2001 21:22:11 -0800 (PST)
From:      Lars Eggert <larse@isi.edu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/32490: umass support for ATAPI [with patch]
Message-ID:  <200112040522.fB45MBj41193@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         32490
>Category:       misc
>Synopsis:       umass support for ATAPI [with patch]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 03 21:30:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Lars Eggert
>Release:        4.4-RELEASE
>Organization:
USC Information Sciences Institute
>Environment:
>Description:
This patch (against 4.4-STABLE) is a slight modification of the 6-to-10 conversion patch Gerd Knops posted to the usb-bsd list (http://groups.yahoo.com/group/usb-bsd/message/1233).

I've verified that it enables attaching, mounting and accessing a Pentax Optio 430 digital camera, which identifies itself as an ATAPI device.

Here is Gerd's description of the patch:
> The umass patch below against FreeBSD 4.3-BETA introduces on the fly
> conversion of 6 byte to 10 byte commands (read, write, mode select,
> mode sense). This should make many devices work that previously would
> have needed an explicit da_quirk_table entry in scsi_da.c.
> 
> I tested Sony Memory stick adapter (UTF) and Sony S70 (RBC), both work
> fine now without an entry in da_quirk_table, hence I removed those
> entries with the patch.
> 
> The patch should also bring us closer to support devices like
> USB-CDROMs. However when I tested I got 'Get Max Lun not supported
> (STALLED)', not sure what is causing this.

I'd be great if this could be committed.
>How-To-Repeat:

>Fix:
533a534,538
> Static int
> umass_6_10_transform __P((struct umass_softc *sc,
> 			     unsigned char *cmd,
> 			     unsigned char **rcmd, int *rcmdlen));
> 
659c664
< #if 0
---
> #if 1
2635a2641,2648
>        /* These commands we can convert 'on the fly' to legal commands */
> 	case READ_6:
> 	case WRITE_6:
> 	case MODE_SELECT_6:
> 	case MODE_SENSE_6:
> 		umass_6_10_transform(sc, cmd, rcmd, rcmdlen);
> 		*rcmdlen = 10;
> 		return 1;               /* success */
2644a2658,2716
> Static int
> umass_6_10_transform(struct umass_softc *sc,
>     unsigned char *cmd,
>     unsigned char **rcmd, int *rcmdlen)
> {
> 	/*
> 	 * This function converts these 6 byte commands to
> 	 * their 10 byte equivalents:
> 	 *
> 	 * READ_6        -> READ_10
> 	 * WRITE_6       -> WRITE_10
> 	 * MODE_SELECT_6 -> MODE_SELECT_10
> 	 * MODE_SENSE_6  -> MODE_SENSE_10
> 	 *
> 	 * NOTE: rcmdlen is NOT modified! The calling code must set
> 	 * it as required for it's context.
> 	 */
> 	KASSERT(*rcmdlen >= 10,
> 	    ("rcmdlen = %d < 10, buffer too small in umass_6_10_transform",
> 		
> 		*rcmdlen));
> 	memset(*rcmd, 0, *rcmdlen);
> 	switch(cmd[0])
> 	    {
> 	    case READ_6:
> 	    case WRITE_6:
> 		    
> 		    if(cmd[0] == WRITE_6) {
> 			    (*rcmd)[0] = WRITE_10;
> 		    } else {
> 			    (*rcmd)[0] = READ_10;
> 		    }
> 		    (*rcmd)[3] = cmd[1];
> 		    (*rcmd)[4] = cmd[2];
> 		    (*rcmd)[5] = cmd[3];
> 		    (*rcmd)[8] = cmd[4];
> 		    (*rcmd)[9] = cmd[5];
> 		    return 1;               /* success */
> 	    case MODE_SELECT_6:
> 		    (*rcmd)[0] = MODE_SELECT_10;
> 		    (*rcmd)[1] = cmd[1];
> 		    (*rcmd)[8] = cmd[4];
> 		    (*rcmd)[9] = cmd[5];
> 		    return 1;               /* success */
> 	    case MODE_SENSE_6:
> 		    (*rcmd)[0] = MODE_SENSE_10;
> 		    (*rcmd)[1] = cmd[1];
> 		    (*rcmd)[2] = cmd[2];
> 		    (*rcmd)[8] = cmd[4];
> 		    (*rcmd)[9] = cmd[5];
> 		    return 1;               /* success */
> 	    }
> 	printf("%s: Unsupported command 0x%02x in umass_6_10_transform",
> 	    USBDEVNAME(sc->sc_dev), cmd[0]);
> 	printf("\n");
> 	return 0;       /* failure */
> }
> 
> 
2688a2761,2762
> 	case SYNCHRONIZE_CACHE:         /* Tested with Sony memory
> 					 * stick adapter */
2693,2701c2767
< 	/* Other UFI commands: FORMAT_UNIT, MODE_SELECT, READ_FORMAT_CAPACITY,
< 	 * VERIFY, WRITE_AND_VERIFY.
< 	 * These should be checked whether they somehow can be made to fit.
< 	 */
< 
< 	/* These commands are known _not_ to work. They should be converted
< 	 * The 6 byte commands can be switched off with a CAM quirk. See
< 	 * the entry for the Y-E data drive.
< 	 */
---
> 	/* 6-bytes commands are converted on the fly */
2705a2772,2776
> 		/* convert on the fly */
> 		umass_6_10_transform(sc, cmd, rcmd, rcmdlen);
> 		return 1;               /* success */
> 		
> 	/* These commands are known _not_ to work. */
2707a2779,2782
> 	/* Other UFI commands: FORMAT_UNIT, MODE_SELECT,
>          * READ_FORMAT_CAPACITY, VERIFY, WRITE_AND_VERIFY. These
>          * should be checked whether they somehow can be made to fit.
>          */
2752,2755c2827
< 	/* These commands are known _not_ to work. They should be converted
< 	 * The 6 byte commands can be switched off with a CAM quirk. See
< 	 * the entry for the Y-E data drive.
< 	 */
---
> 	/* 6-bytes commands are converted on the fly */
2759a2832,2834
> 		umass_6_10_transform(sc, cmd, rcmd, rcmdlen);
> 		return 1;               /* success */
>        /* These commands are known _not_ to work */

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112040522.fB45MBj41193>