Date: Fri, 28 Jan 2005 20:26:20 +0900 (JST) From: Yamamoto Shigeru <shigeru@iij.ad.jp> To: freebsd-current@freebsd.org Subject: USB Memory support quick hack Message-ID: <20050128.202620.28780845.shigeru@iij.ad.jp>
next in thread | raw e-mail | index | archive | help
----Next_Part(Fri_Jan_28_20:26:20_2005_540)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi all, I write a small patch to support USB memory without adding an entry to da_quirk_table[]. Idea in this patch is disable SYNC_CACHE when synchronize cache failed. This new feature is controled by "kern.cam.da.fallback_no_sync_cache". I test my USB memory (TOSHIBA TransMemory) which is not in da_quirk_table[]. [test resutl] # sysctl kern.cam.da.fallback_no_sync_cache kern.cam.da.fallback_no_sync_cache: 0 # umass1: TOSHIBA TransMemory, rev 2.00/1.00, addr 2 da2 at umass-sim1 bus 1 target 0 lun 0 da2: <TOSHIBA TransMemory 1.00> Removable Direct Access SCSI-0 device da2: 1.000MB/s transfers da2: 240MB (492544 512 byte sectors: 64H 32S/T 240C) umass1: Phase Error, residue = 0 (da2:umass-sim1:1:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0 umass1: Phase Error, residue = 0 (da2:umass-sim1:1:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0 umass1: Phase Error, residue = 0 (da2:umass-sim1:1:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0 umass1: Phase Error, residue = 0 (da2:umass-sim1:1:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0 umass1: Phase Error, residue = 0 (da2:umass-sim1:1:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0 umass1: Phase Error, residue = 0 (da2:umass-sim1:1:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0 umass1: Phase Error, residue = 0 (da2:umass-sim1:1:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0 # sysctl -w kern.cam.da.fallback_no_sync_cache=1 kern.cam.da.fallback_no_sync_cache: 0 -> 1 # umass1: TOSHIBA TransMemory, rev 2.00/1.00, addr 2 da2 at umass-sim1 bus 1 target 0 lun 0 da2: <TOSHIBA TransMemory 1.00> Removable Direct Access SCSI-0 device da2: 1.000MB/s transfers da2: 240MB (492544 512 byte sectors: 64H 32S/T 240C) umass1: Phase Error, residue = 0 (da2:umass-sim1:1:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0 (da2:umass-sim1:1:0:0): Disable SYNC_CACHE If you have interest my patch, please try it. Thanks, ------- YAMAMOTO Shigeru <shigeru@iij.ad.jp> ----Next_Part(Fri_Jan_28_20:26:20_2005_540)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="scsi_da.c.diff" Index: sys/cam/scsi/scsi_da.c =================================================================== RCS file: /share/cvsup/FreeBSD/current/usr/src/sys/cam/scsi/scsi_da.c,v retrieving revision 1.173 diff -u -r1.173 scsi_da.c --- sys/cam/scsi/scsi_da.c 5 Jan 2005 22:34:34 -0000 1.173 +++ sys/cam/scsi/scsi_da.c 28 Jan 2005 08:19:15 -0000 @@ -348,6 +348,7 @@ static int da_retry_count = DA_DEFAULT_RETRY; static int da_default_timeout = DA_DEFAULT_TIMEOUT; +static int da_fallback_no_sync_cache = 0; SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); @@ -357,6 +358,9 @@ SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RW, &da_default_timeout, 0, "Normal I/O timeout (in seconds)"); TUNABLE_INT("kern.cam.da.default_timeout", &da_default_timeout); +SYSCTL_INT(_kern_cam_da, OID_AUTO, fallback_no_sync_cache, CTLFLAG_RW, + &da_fallback_no_sync_cache, 0, "Fallback to no sync cache"); +TUNABLE_INT("kern.cam.da.fallback_no_sync_cache", &da_fallback_no_sync_cache); /* * DA_ORDEREDTAG_INTERVAL determines how often, relative @@ -498,6 +502,11 @@ "== 0x%x, scsi status == 0x%x\n", ccb->csio.ccb_h.status, ccb->csio.scsi_status); + if (da_fallback_no_sync_cache) { + xpt_print_path(periph->path); + printf("Disable SYNC_CACHE\n"); + softc->quirks |= DA_Q_NO_SYNC_CACHE; + } } } @@ -669,6 +678,11 @@ printf("Synchronize cache failed, status " "== 0x%x, scsi status == 0x%x\n", csio.ccb_h.status, csio.scsi_status); + if (da_fallback_no_sync_cache) { + xpt_print_path(periph->path); + printf("Disable SYNC_CACHE\n"); + softc->quirks |= DA_Q_NO_SYNC_CACHE; + } } } } @@ -1818,6 +1832,11 @@ printf("Synchronize cache failed, status " "== 0x%x, scsi status == 0x%x\n", ccb.ccb_h.status, ccb.csio.scsi_status); + if (da_fallback_no_sync_cache) { + xpt_print_path(periph->path); + printf("Disable SYNC_CACHE\n"); + softc->quirks |= DA_Q_NO_SYNC_CACHE; + } } } ----Next_Part(Fri_Jan_28_20:26:20_2005_540)----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050128.202620.28780845.shigeru>