diff options
Diffstat (limited to 'hw/block/block.c')
-rw-r--r-- | hw/block/block.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/block/block.c b/hw/block/block.c index b6c80ab..b91e2b6 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -108,6 +108,20 @@ bool blkconf_geometry(BlockConf *conf, int *ptrans, unsigned cyls_max, unsigned heads_max, unsigned secs_max, Error **errp) { + DriveInfo *dinfo; + + if (!conf->cyls && !conf->heads && !conf->secs) { + /* try to fall back to value set with legacy -drive cyls=... */ + dinfo = blk_legacy_dinfo(conf->blk); + if (dinfo) { + conf->cyls = dinfo->cyls; + conf->heads = dinfo->heads; + conf->secs = dinfo->secs; + if (ptrans) { + *ptrans = dinfo->trans; + } + } + } if (!conf->cyls && !conf->heads && !conf->secs) { hd_geometry_guess(conf->blk, &conf->cyls, &conf->heads, &conf->secs, |