浏览代码

[libata] allow ATAPI to be enabled with new atapi_enabled module option

ATAPI is getting close to being ready.  To increase exposure, we enable
the code in the upstream kernel, but default it to off (present
behavior).  Users must pass atapi_enabled=1 as a module option (if
module) or on the kernel command line (if built in) to turn on
discovery of their ATAPI devices.
Jeff Garzik 20 年之前
父节点
当前提交
1623c81eec
共有 4 个文件被更改,包括 9 次插入5 次删除
  1. 4 0
      drivers/scsi/libata-core.c
  2. 4 4
      drivers/scsi/libata-scsi.c
  3. 1 0
      drivers/scsi/libata.h
  4. 0 1
      include/linux/libata.h

+ 4 - 0
drivers/scsi/libata-core.c

@@ -75,6 +75,10 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc);
 static unsigned int ata_unique_id = 1;
 static unsigned int ata_unique_id = 1;
 static struct workqueue_struct *ata_wq;
 static struct workqueue_struct *ata_wq;
 
 
+int atapi_enabled = 0;
+module_param(atapi_enabled, int, 0444);
+MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)");
+
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_LICENSE("GPL");
 MODULE_LICENSE("GPL");

+ 4 - 4
drivers/scsi/libata-scsi.c

@@ -1470,10 +1470,10 @@ ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev)
 	if (unlikely(!ata_dev_present(dev)))
 	if (unlikely(!ata_dev_present(dev)))
 		return NULL;
 		return NULL;
 
 
-#ifndef ATA_ENABLE_ATAPI
-	if (unlikely(dev->class == ATA_DEV_ATAPI))
-		return NULL;
-#endif
+	if (atapi_enabled) {
+		if (unlikely(dev->class == ATA_DEV_ATAPI))
+			return NULL;
+	}
 
 
 	return dev;
 	return dev;
 }
 }

+ 1 - 0
drivers/scsi/libata.h

@@ -38,6 +38,7 @@ struct ata_scsi_args {
 };
 };
 
 
 /* libata-core.c */
 /* libata-core.c */
+extern int atapi_enabled;
 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
 				      struct ata_device *dev);
 				      struct ata_device *dev);
 extern void ata_qc_free(struct ata_queued_cmd *qc);
 extern void ata_qc_free(struct ata_queued_cmd *qc);

+ 0 - 1
include/linux/libata.h

@@ -40,7 +40,6 @@
 #undef ATA_VERBOSE_DEBUG	/* yet more debugging output */
 #undef ATA_VERBOSE_DEBUG	/* yet more debugging output */
 #undef ATA_IRQ_TRAP		/* define to ack screaming irqs */
 #undef ATA_IRQ_TRAP		/* define to ack screaming irqs */
 #undef ATA_NDEBUG		/* define to disable quick runtime checks */
 #undef ATA_NDEBUG		/* define to disable quick runtime checks */
-#undef ATA_ENABLE_ATAPI		/* define to enable ATAPI support */
 #undef ATA_ENABLE_PATA		/* define to enable PATA support in some
 #undef ATA_ENABLE_PATA		/* define to enable PATA support in some
 				 * low-level drivers */
 				 * low-level drivers */
 #undef ATAPI_ENABLE_DMADIR	/* enables ATAPI DMADIR bridge support */
 #undef ATAPI_ENABLE_DMADIR	/* enables ATAPI DMADIR bridge support */