Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/scsi/scsi_da.c
Show First 20 Lines • Show All 397 Lines • ▼ Show 20 Lines | |||||
#define dadeleteflag(softc, delete_method, enable) \ | #define dadeleteflag(softc, delete_method, enable) \ | ||||
if (enable) { \ | if (enable) { \ | ||||
softc->delete_available |= (1 << delete_method); \ | softc->delete_available |= (1 << delete_method); \ | ||||
} else { \ | } else { \ | ||||
softc->delete_available &= ~(1 << delete_method); \ | softc->delete_available &= ~(1 << delete_method); \ | ||||
} | } | ||||
static uma_zone_t da_ccb_zone; | |||||
struct da_quirk_entry { | struct da_quirk_entry { | ||||
struct scsi_inquiry_pattern inq_pat; | struct scsi_inquiry_pattern inq_pat; | ||||
da_quirks quirks; | da_quirks quirks; | ||||
}; | }; | ||||
static const char quantum[] = "QUANTUM"; | static const char quantum[] = "QUANTUM"; | ||||
static const char microp[] = "MICROP"; | static const char microp[] = "MICROP"; | ||||
▲ Show 20 Lines • Show All 1,138 Lines • ▼ Show 20 Lines | |||||
static int da_poll_period = DA_DEFAULT_POLL_PERIOD; | static int da_poll_period = DA_DEFAULT_POLL_PERIOD; | ||||
static int da_retry_count = DA_DEFAULT_RETRY; | static int da_retry_count = DA_DEFAULT_RETRY; | ||||
static int da_default_timeout = DA_DEFAULT_TIMEOUT; | static int da_default_timeout = DA_DEFAULT_TIMEOUT; | ||||
static sbintime_t da_default_softtimeout = DA_DEFAULT_SOFTTIMEOUT; | static sbintime_t da_default_softtimeout = DA_DEFAULT_SOFTTIMEOUT; | ||||
static int da_send_ordered = DA_DEFAULT_SEND_ORDERED; | static int da_send_ordered = DA_DEFAULT_SEND_ORDERED; | ||||
static int da_disable_wp_detection = 0; | static int da_disable_wp_detection = 0; | ||||
static int da_enable_biospeedup = 1; | static int da_enable_biospeedup = 1; | ||||
static int da_enable_uma_ccbs = 0; | |||||
static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"CAM Direct Access Disk driver"); | "CAM Direct Access Disk driver"); | ||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, poll_period, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_da, OID_AUTO, poll_period, CTLFLAG_RWTUN, | ||||
&da_poll_period, 0, "Media polling period in seconds"); | &da_poll_period, 0, "Media polling period in seconds"); | ||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, retry_count, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_da, OID_AUTO, retry_count, CTLFLAG_RWTUN, | ||||
&da_retry_count, 0, "Normal I/O retry count"); | &da_retry_count, 0, "Normal I/O retry count"); | ||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RWTUN, | ||||
&da_default_timeout, 0, "Normal I/O timeout (in seconds)"); | &da_default_timeout, 0, "Normal I/O timeout (in seconds)"); | ||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RWTUN, | ||||
&da_send_ordered, 0, "Send Ordered Tags"); | &da_send_ordered, 0, "Send Ordered Tags"); | ||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, disable_wp_detection, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_da, OID_AUTO, disable_wp_detection, CTLFLAG_RWTUN, | ||||
&da_disable_wp_detection, 0, | &da_disable_wp_detection, 0, | ||||
"Disable detection of write-protected disks"); | "Disable detection of write-protected disks"); | ||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN, | SYSCTL_INT(_kern_cam_da, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN, | ||||
&da_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing"); | &da_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing"); | ||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, enable_uma_ccbs, CTLFLAG_RWTUN, | |||||
&da_enable_uma_ccbs, 0, "Use UMA for CCBs"); | |||||
SYSCTL_PROC(_kern_cam_da, OID_AUTO, default_softtimeout, | SYSCTL_PROC(_kern_cam_da, OID_AUTO, default_softtimeout, | ||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, NULL, 0, | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, NULL, 0, | ||||
dasysctlsofttimeout, "I", | dasysctlsofttimeout, "I", | ||||
"Soft I/O timeout (ms)"); | "Soft I/O timeout (ms)"); | ||||
TUNABLE_INT64("kern.cam.da.default_softtimeout", &da_default_softtimeout); | TUNABLE_INT64("kern.cam.da.default_softtimeout", &da_default_softtimeout); | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | if (status != CAM_REQ_CMP) { | ||||
printf("da: Failed to attach master async callback " | printf("da: Failed to attach master async callback " | ||||
"due to status 0x%x!\n", status); | "due to status 0x%x!\n", status); | ||||
} else if (da_send_ordered) { | } else if (da_send_ordered) { | ||||
/* Register our shutdown event handler */ | /* Register our shutdown event handler */ | ||||
if ((EVENTHANDLER_REGISTER(shutdown_post_sync, dashutdown, | if ((EVENTHANDLER_REGISTER(shutdown_post_sync, dashutdown, | ||||
NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) | NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) | ||||
printf("dainit: shutdown event registration failed!\n"); | printf("dainit: shutdown event registration failed!\n"); | ||||
} | } | ||||
da_ccb_zone = uma_zcreate("da_ccb", | |||||
sizeof(struct ccb_scsiio), NULL, NULL, NULL, NULL, | |||||
UMA_ALIGN_PTR, 0); | |||||
} | } | ||||
/* | /* | ||||
* Callback from GEOM, called when it has finished cleaning up its | * Callback from GEOM, called when it has finished cleaning up its | ||||
* resources. | * resources. | ||||
*/ | */ | ||||
static void | static void | ||||
dadiskgonecb(struct disk *dp) | dadiskgonecb(struct disk *dp) | ||||
▲ Show 20 Lines • Show All 820 Lines • ▼ Show 20 Lines | if (scsi_vpd_supported_page(periph, SVPD_ATA_INFORMATION)) { | ||||
softc->zone_interface = DA_ZONE_IF_ATA_SAT; | softc->zone_interface = DA_ZONE_IF_ATA_SAT; | ||||
else | else | ||||
softc->zone_interface = DA_ZONE_IF_ATA_PASS; | softc->zone_interface = DA_ZONE_IF_ATA_PASS; | ||||
} else | } else | ||||
softc->zone_interface = DA_ZONE_IF_SCSI; | softc->zone_interface = DA_ZONE_IF_SCSI; | ||||
} | } | ||||
TASK_INIT(&softc->sysctl_task, 0, dasysctlinit, periph); | TASK_INIT(&softc->sysctl_task, 0, dasysctlinit, periph); | ||||
/* | |||||
* Let XPT know we can use UMA-allocated CCBs. | |||||
*/ | |||||
if (da_enable_uma_ccbs) | |||||
periph->ccb_zone = da_ccb_zone; | |||||
imp: why no similar KASSERT here to the ada case? | |||||
/* | /* | ||||
* Take an exclusive section lock on the periph while dastart is called | * Take an exclusive section lock on the periph while dastart is called | ||||
* to finish the probe. The lock will be dropped in dadone at the end | * to finish the probe. The lock will be dropped in dadone at the end | ||||
* of probe. This locks out daopen and daclose from racing with the | * of probe. This locks out daopen and daclose from racing with the | ||||
* probe. | * probe. | ||||
* | * | ||||
* XXX if cam_periph_hold returns an error, we don't hold a refcount. | * XXX if cam_periph_hold returns an error, we don't hold a refcount. | ||||
▲ Show 20 Lines • Show All 3,785 Lines • Show Last 20 Lines |
why no similar KASSERT here to the ada case?