mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
Changes to -drive without if= and with if=scsi
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJYrDELAAoJEDhwtADrkYZTUzIP/0h+Cg73nzEX7bEfP1tXMJ7A 9Byzvi5HDOayaAScqu459hJcGdhhkh2XhMN9rZ8xlCOVOxT765raMAv9XqhPMT08 C+btkD6a2b3CRSdf+omztSIkXqgrLZyj7lkwPQFM6bBU7th4uBv0RBus+oB/1Ahd zP/Kg5PqNTA8cRV6LK2R3GnUeJXXYxGbzM1z6fSMFIhmZj4Y/l/uWEjhi8K2w2aX oSoWv6sNgvNhs/JeJZvIATA3tbEoQunW3UGmbjjGQenJ2SLqShxtaO5luaS/P6WB oXEQw5J1Ar10Y0UvTSDusuYCbbFJlo98Pqv4X88166nmSTS9A+n3jkxwawYPQygT WK7ZtIUuz4ItxtVrVrtVilveujihITgbqyy5GtQOzYcbmLQwcAxH/z1W8UNwp31K pNL5V/IVia5z7g1pD++FCNIk+wxtQrwrytFZzeCLSzac/X0qdgJ+IQmmC+Y48FB7 Iqe9xgxHQHZ2HlHrLLltcgzOv9NPZ/wr6irOGEvc32nK3ZLP70wWCrNLw6Cqvi+c KeChpZ9JD7+kr+fQJ3P+Zq8cMJ5jX1KA5ANaHavVHRRB0U4frSWal/dsQwnVHC2o 7h4/KMjSPCsl3/dzxhP0T8RvvkqN+KnCn4dhxzzFDeOWHiW8jwc9ZfmWvzoIgVYJ fwA2tuXpPoAuzNoLcpVi =/97H -----END PGP SIGNATURE----- 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>
This commit is contained in:
commit
a1cf5fac2b
37 changed files with 137 additions and 97 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue