@@ -89,7 +89,8 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv, int
const char *driver;
DeviceState *dev;
- driver = bdrv_is_sg(bdrv) ? "scsi-generic" : "scsi-disk";
+ driver = bdrv_is_bsg(bdrv) ? "scsi-bsg" :
+ bdrv_is_sg(bdrv) ? "scsi-generic" : "scsi-disk";
dev = qdev_create(&bus->qbus, driver);
qdev_prop_set_uint32(dev, "scsi-id", unit);
if (qdev_prop_set_drive(dev, "drive", bdrv) < 0) {
@@ -1201,6 +1201,11 @@ static int scsi_disk_initfn(SCSIDevice *dev)
return -1;
}
+ if (bdrv_is_bsg(s->bs)) {
+ error_report("scsi-disk: unwanted BSG");
+ return -1;
+ }
+
if (is_cd) {
s->qdev.blocksize = 2048;
} else {