aboutsummaryrefslogtreecommitdiff
path: root/sys/cam
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/ata/ata_da.c4
-rw-r--r--sys/cam/ata/ata_xpt.c29
-rw-r--r--sys/cam/cam_xpt.c7
-rw-r--r--sys/cam/scsi/scsi_all.h2
-rw-r--r--sys/cam/scsi/scsi_cd.c9
-rw-r--r--sys/cam/scsi/scsi_da.c5
-rw-r--r--sys/cam/scsi/scsi_sg.c2
7 files changed, 37 insertions, 21 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index 6cb4f2e55091..6eff691de907 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -686,14 +686,10 @@ adaregister(struct cam_periph *periph, void *arg)
else
softc->quirks = ADA_Q_NONE;
- /* Check if the SIM does not want queued commands */
bzero(&cpi, sizeof(cpi));
xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE);
cpi.ccb_h.func_code = XPT_PATH_INQ;
xpt_action((union ccb *)&cpi);
- if (cpi.ccb_h.status != CAM_REQ_CMP ||
- (cpi.hba_inquiry & PI_TAG_ABLE) == 0)
- softc->flags &= ~ADA_FLAG_CAN_NCQ;
TASK_INIT(&softc->sysctl_task, 0, adasysctlinit, periph);
diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c
index d5e0b32a49b1..3bf9c1ef1dfa 100644
--- a/sys/cam/ata/ata_xpt.c
+++ b/sys/cam/ata/ata_xpt.c
@@ -766,6 +766,7 @@ noerror:
}
case PROBE_IDENTIFY:
{
+ struct ccb_pathinq cpi;
int16_t *ptr;
ident_buf = &softc->ident_data;
@@ -840,16 +841,24 @@ noerror:
ata_find_quirk(path->device);
if (path->device->mintags != 0 &&
path->bus->sim->max_tagged_dev_openings != 0) {
- /* Report SIM which tags are allowed. */
- bzero(&cts, sizeof(cts));
- xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
- cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
- cts.type = CTS_TYPE_CURRENT_SETTINGS;
- cts.xport_specific.sata.tags = path->device->maxtags;
- cts.xport_specific.sata.valid = CTS_SATA_VALID_TAGS;
- xpt_action((union ccb *)&cts);
- /* Reconfigure queues for tagged queueing. */
- xpt_start_tags(path);
+ /* Check if the SIM does not want queued commands. */
+ bzero(&cpi, sizeof(cpi));
+ xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
+ cpi.ccb_h.func_code = XPT_PATH_INQ;
+ xpt_action((union ccb *)&cpi);
+ if (cpi.ccb_h.status == CAM_REQ_CMP &&
+ (cpi.hba_inquiry & PI_TAG_ABLE)) {
+ /* Report SIM which tags are allowed. */
+ bzero(&cts, sizeof(cts));
+ xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
+ cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
+ cts.type = CTS_TYPE_CURRENT_SETTINGS;
+ cts.xport_specific.sata.tags = path->device->maxtags;
+ cts.xport_specific.sata.valid = CTS_SATA_VALID_TAGS;
+ xpt_action((union ccb *)&cts);
+ /* Reconfigure queues for tagged queueing. */
+ xpt_start_tags(path);
+ }
}
ata_device_transport(path);
PROBE_SET_ACTION(softc, PROBE_SETMODE);
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 4871e85b7972..1812edbf70e4 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -2380,6 +2380,7 @@ xpt_action_default(union ccb *start_ccb)
if (start_ccb->ccb_h.func_code == XPT_ATA_IO) {
start_ccb->ataio.resid = 0;
}
+ /* FALLTHROUGH */
case XPT_RESET_DEV:
case XPT_ENG_EXEC:
{
@@ -2888,6 +2889,9 @@ xpt_action_default(union ccb *start_ccb)
case XPT_ENG_INQ:
/* XXX Implement */
start_ccb->ccb_h.status = CAM_PROVIDE_FAIL;
+ if (start_ccb->ccb_h.func_code & XPT_FC_DEV_QUEUED) {
+ xpt_done(start_ccb);
+ }
break;
}
}
@@ -3930,7 +3934,7 @@ xpt_dev_async_default(u_int32_t async_code, struct cam_eb *bus,
struct cam_et *target, struct cam_ed *device,
void *async_arg)
{
- printf("xpt_dev_async called\n");
+ printf("%s called\n", __func__);
}
u_int32_t
@@ -4919,4 +4923,3 @@ camisr_runqueue(void *V_queue)
(*ccb_h->cbfcnp)(ccb_h->path->periph, (union ccb *)ccb_h);
}
}
-
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h
index 029b2ccd136f..d6b6e81c871f 100644
--- a/sys/cam/scsi/scsi_all.h
+++ b/sys/cam/scsi/scsi_all.h
@@ -170,6 +170,8 @@ struct scsi_mode_sense_6
#define SMS_PAGE_CODE 0x3F
#define SMS_VENDOR_SPECIFIC_PAGE 0x00
#define SMS_DISCONNECT_RECONNECT_PAGE 0x02
+#define SMS_FORMAT_DEVICE_PAGE 0x03
+#define SMS_GEOMETRY_PAGE 0x04
#define SMS_CACHE_PAGE 0x08
#define SMS_PERIPHERAL_DEVICE_PAGE 0x09
#define SMS_CONTROL_MODE_PAGE 0x0A
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 1e5be3c58866..d09d129a9472 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -2773,8 +2773,12 @@ cdcheckmedia(struct cam_periph *periph)
softc->flags &= ~(CD_FLAG_VALID_MEDIA|CD_FLAG_VALID_TOC);
cdprevent(periph, PR_ALLOW);
return (error);
- } else
+ } else {
softc->flags |= CD_FLAG_VALID_MEDIA;
+ softc->disk->d_sectorsize = softc->params.blksize;
+ softc->disk->d_mediasize =
+ (off_t)softc->params.blksize * softc->params.disksize;
+ }
/*
* Now we check the table of contents. This (currently) is only
@@ -2863,9 +2867,6 @@ cdcheckmedia(struct cam_periph *periph)
}
softc->flags |= CD_FLAG_VALID_TOC;
- softc->disk->d_sectorsize = softc->params.blksize;
- softc->disk->d_mediasize =
- (off_t)softc->params.blksize * softc->params.disksize;
bailout:
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 77652b2dc949..377275a86e52 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -997,6 +997,11 @@ dacleanup(struct cam_periph *periph)
xpt_print(periph->path, "can't remove sysctl context\n");
}
+ /*
+ * Nullify our periph pointer here to try and catch
+ * race conditions in callbacks/downcalls.
+ */
+ softc->disk->d_drv1 = NULL;
disk_destroy(softc->disk);
callout_drain(&softc->sendordered_c);
free(softc, M_DEVBUF);
diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c
index d47e6e9adb3a..8ec01895dfad 100644
--- a/sys/cam/scsi/scsi_sg.c
+++ b/sys/cam/scsi/scsi_sg.c
@@ -586,7 +586,7 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
{
struct sg_scsi_id id;
- id.host_no = 0; /* XXX */
+ id.host_no = cam_sim_path(xpt_path_sim(periph->path));
id.channel = xpt_path_path_id(periph->path);
id.scsi_id = xpt_path_target_id(periph->path);
id.lun = xpt_path_lun_id(periph->path);