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_at_iij.ad.jp> 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 _at__at_ -348,6 +348,7 _at__at_ 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"); _at__at_ -357,6 +358,9 _at__at_ 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 _at__at_ -498,6 +502,11 _at__at_ "== 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; + } } } _at__at_ -669,6 +678,11 _at__at_ 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; + } } } } _at__at_ -1818,6 +1832,11 _at__at_ 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; + } } }Received on Fri Jan 28 2005 - 10:26:24 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:27 UTC