aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi/scsi-bus.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-02-21 13:58:50 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-02-21 13:58:50 +0000
commita1cf5fac2b929ffa2abd1285401f2535ff8c6fea (patch)
tree1cadd786c3de02c3d817bb934b24b3b45f7369e1 /hw/scsi/scsi-bus.c
parenta0775e28cd6cae7eae248f74db7bc4a03da20c6b (diff)
parentf778a82f0c179634892ea716970d4d35264dc841 (diff)
downloadqemu-a1cf5fac2b929ffa2abd1285401f2535ff8c6fea.zip
qemu-a1cf5fac2b929ffa2abd1285401f2535ff8c6fea.tar.gz
qemu-a1cf5fac2b929ffa2abd1285401f2535ff8c6fea.tar.bz2
Merge remote-tracking branch 'remotes/armbru/tags/pull-block-2017-02-21' into staging
Changes to -drive without if= and with if=scsi # gpg: Signature made Tue 21 Feb 2017 12:22:35 GMT # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-block-2017-02-21: hw/i386: Deprecate -drive if=scsi with PC machine types hw: Deprecate -drive if=scsi with non-onboard HBAs hw/scsi: Concentrate -drive if=scsi auto-create in one place hw: Drop superfluous special checks for orphaned -drive blockdev: Make orphaned -drive fatal blockdev: Improve message for orphaned -drive hw/arm/highbank: Default -drive to if=ide instead of if=scsi hw: Default -drive to if=none instead of scsi when scsi cannot work hw: Default -drive to if=none instead of ide when ide cannot work hw/arm/cubieboard hw/arm/xlnx-ep108: Fix units_per_default_bus hw: Default -drive to if=ide explicitly where it works Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/scsi/scsi-bus.c')
-rw-r--r--hw/scsi/scsi-bus.c56
1 files changed, 49 insertions, 7 deletions
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index c9f0ac0..f557446 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -263,12 +263,11 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
return SCSI_DEVICE(dev);
}
-void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, Error **errp)
+void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)
{
Location loc;
DriveInfo *dinfo;
int unit;
- Error *err = NULL;
loc_push_none(&loc);
for (unit = 0; unit <= bus->info->max_target; unit++) {
@@ -277,16 +276,59 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, Error **errp)
continue;
}
qemu_opts_loc_restore(dinfo->opts);
- scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),
- unit, false, -1, NULL, &err);
- if (err != NULL) {
- error_propagate(errp, err);
- break;
+ if (deprecated) {
+ /* Handling -drive not claimed by machine initialization */
+ if (blk_get_attached_dev(blk_by_legacy_dinfo(dinfo))) {
+ continue; /* claimed */
+ }
+ if (!dinfo->is_default) {
+ error_report("warning: bus=%d,unit=%d is deprecated with this"
+ " machine type",
+ bus->busnr, unit);
+ }
}
+ scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),
+ unit, false, -1, NULL, &error_fatal);
}
loc_pop(&loc);
}
+static bool is_scsi_hba_with_legacy_magic(Object *obj)
+{
+ static const char *magic[] = {
+ "am53c974", "dc390", "esp", "lsi53c810", "lsi53c895a",
+ "megasas", "megasas-gen2", "mptsas1068", "spapr-vscsi",
+ "virtio-scsi-device",
+ NULL
+ };
+ const char *typename = object_get_typename(obj);
+ int i;
+
+ for (i = 0; magic[i]; i++)
+ if (!strcmp(typename, magic[i])) {
+ return true;
+ }
+
+ return false;
+}
+
+static int scsi_legacy_handle_cmdline_cb(Object *obj, void *opaque)
+{
+ SCSIBus *bus = (SCSIBus *)object_dynamic_cast(obj, TYPE_SCSI_BUS);
+
+ if (bus && is_scsi_hba_with_legacy_magic(OBJECT(bus->qbus.parent))) {
+ scsi_bus_legacy_handle_cmdline(bus, true);
+ }
+
+ return 0;
+}
+
+void scsi_legacy_handle_cmdline(void)
+{
+ object_child_foreach_recursive(object_get_root(),
+ scsi_legacy_handle_cmdline_cb, NULL);
+}
+
static int32_t scsi_invalid_field(SCSIRequest *req, uint8_t *buf)
{
scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD));