summaryrefslogtreecommitdiffstats
path: root/hw/ide/core.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2012-07-11 15:08:39 +0200
committerKevin Wolf <kwolf@redhat.com>2012-07-17 16:48:32 +0200
commitb7eb0c9f95e50239ce5b5266373dc52c85e75299 (patch)
treeb82a0d11cbb8466b37c3684f2c873b78c52eef4b /hw/ide/core.c
parent577d0a38070d1d6c4c7fab5c2054380770b1ec6b (diff)
downloadhqemu-b7eb0c9f95e50239ce5b5266373dc52c85e75299.zip
hqemu-b7eb0c9f95e50239ce5b5266373dc52c85e75299.tar.gz
hw/block-common: Factor out fall back to legacy -drive cyls=...
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/core.c')
-rw-r--r--hw/ide/core.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 5378fc3..d65ef3d 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1935,18 +1935,6 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
s->drive_kind = kind;
bdrv_get_geometry(bs, &nb_sectors);
- if (cylinders < 1 || cylinders > 65535) {
- error_report("cyls must be between 1 and 65535");
- return -1;
- }
- if (heads < 1 || heads > 16) {
- error_report("heads must be between 1 and 16");
- return -1;
- }
- if (secs < 1 || secs > 255) {
- error_report("secs must be between 1 and 255");
- return -1;
- }
s->cylinders = cylinders;
s->heads = heads;
s->sectors = secs;
@@ -2094,6 +2082,18 @@ void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
} else if (trans == BIOS_ATA_TRANSLATION_AUTO) {
trans = hd_bios_chs_auto_trans(cyls, heads, secs);
}
+ if (cyls < 1 || cyls > 65535) {
+ error_report("cyls must be between 1 and 65535");
+ exit(1);
+ }
+ if (heads < 1 || heads > 16) {
+ error_report("heads must be between 1 and 16");
+ exit(1);
+ }
+ if (secs < 1 || secs > 255) {
+ error_report("secs must be between 1 and 255");
+ exit(1);
+ }
if (ide_init_drive(&bus->ifs[i], dinfo->bdrv,
dinfo->media_cd ? IDE_CD : IDE_HD,
NULL, dinfo->serial, NULL, 0,
OpenPOWER on IntegriCloud