return NULL;
}
+/**
+ * ata_scsi_simulate - simulate SCSI command on ATA device
+ * @dev: the target device
+ * @cmd: SCSI command being sent to device.
+ *
+ * Interprets and directly executes a select list of SCSI commands
+ * that can be handled internally.
+ *
+ * LOCKING:
+ * spin_lock_irqsave(host lock)
+ */
+static void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
+{
+ const u8 *scsicmd = cmd->cmnd;
+ u8 tmp8;
+
+ switch (scsicmd[0]) {
+ case INQUIRY:
+ ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_inquiry);
+ break;
+
+ case MODE_SENSE:
+ case MODE_SENSE_10:
+ ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_mode_sense);
+ break;
+
+ case READ_CAPACITY:
+ case SERVICE_ACTION_IN_16:
+ ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_read_cap);
+ break;
+
+ case REPORT_LUNS:
+ ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_report_luns);
+ break;
+
+ case REQUEST_SENSE:
+ ata_scsi_set_sense(dev, cmd, 0, 0, 0);
+ break;
+
+ /* if we reach this, then writeback caching is disabled,
+ * turning this into a no-op.
+ */
+ case SYNCHRONIZE_CACHE:
+ case SYNCHRONIZE_CACHE_16:
+ fallthrough;
+
+ /* no-op's, complete with success */
+ case REZERO_UNIT:
+ case SEEK_6:
+ case SEEK_10:
+ case TEST_UNIT_READY:
+ break;
+
+ case SEND_DIAGNOSTIC:
+ tmp8 = scsicmd[1] & ~(1 << 3);
+ if (tmp8 != 0x4 || scsicmd[3] || scsicmd[4])
+ ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
+ break;
+
+ case MAINTENANCE_IN:
+ ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_maint_in);
+ break;
+
+ /* all other commands */
+ default:
+ ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0);
+ /* "Invalid command operation code" */
+ break;
+ }
+
+ scsi_done(cmd);
+}
+
enum scsi_qc_status __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
struct ata_device *dev)
{
}
EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
-/**
- * ata_scsi_simulate - simulate SCSI command on ATA device
- * @dev: the target device
- * @cmd: SCSI command being sent to device.
- *
- * Interprets and directly executes a select list of SCSI commands
- * that can be handled internally.
- *
- * LOCKING:
- * spin_lock_irqsave(host lock)
- */
-
-void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
-{
- const u8 *scsicmd = cmd->cmnd;
- u8 tmp8;
-
- switch(scsicmd[0]) {
- case INQUIRY:
- ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_inquiry);
- break;
-
- case MODE_SENSE:
- case MODE_SENSE_10:
- ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_mode_sense);
- break;
-
- case READ_CAPACITY:
- case SERVICE_ACTION_IN_16:
- ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_read_cap);
- break;
-
- case REPORT_LUNS:
- ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_report_luns);
- break;
-
- case REQUEST_SENSE:
- ata_scsi_set_sense(dev, cmd, 0, 0, 0);
- break;
-
- /* if we reach this, then writeback caching is disabled,
- * turning this into a no-op.
- */
- case SYNCHRONIZE_CACHE:
- case SYNCHRONIZE_CACHE_16:
- fallthrough;
-
- /* no-op's, complete with success */
- case REZERO_UNIT:
- case SEEK_6:
- case SEEK_10:
- case TEST_UNIT_READY:
- break;
-
- case SEND_DIAGNOSTIC:
- tmp8 = scsicmd[1] & ~(1 << 3);
- if (tmp8 != 0x4 || scsicmd[3] || scsicmd[4])
- ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
- break;
-
- case MAINTENANCE_IN:
- ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_maint_in);
- break;
-
- /* all other commands */
- default:
- ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0);
- /* "Invalid command operation code" */
- break;
- }
-
- scsi_done(cmd);
-}
-
int ata_scsi_add_hosts(struct ata_host *host, const struct scsi_host_template *sht)
{
int i, rc;