[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 24/41] ide: qdev property for BIOS CHS translation
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 24/41] ide: qdev property for BIOS CHS translation |
Date: |
Tue, 17 Jul 2012 18:00:21 +0200 |
From: Markus Armbruster <address@hidden>
This isn't quite orthodox. CHS translation is firmware configuration,
communicated via the RTC's CMOS RAM, not a property of the disk. But
it's best to treat it just like geometry anyway.
Maintain backward compatibility exactly like for geometry: fall back
to DriveInfo's translation, set with -drive trans=...
Bonus: info qtree now shows the translation. Except when it shows
"auto": that's resolved by pc_cmos_init_late(). To be addressed
shortly.
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/ide/internal.h | 1 +
hw/ide/qdev.c | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 685e976..c3ecafc 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -474,6 +474,7 @@ struct IDEDevice {
DeviceState qdev;
uint32_t unit;
BlockConf conf;
+ int chs_trans;
char *version;
char *serial;
char *model;
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 3e297dc..f191dd3 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -144,7 +144,6 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
IDEState *s = bus->ifs + dev->unit;
const char *serial;
DriveInfo *dinfo;
- int trans;
if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512)
{
error_report("discard_granularity must be 512 for ide");
@@ -160,25 +159,24 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind
kind)
}
}
- trans = BIOS_ATA_TRANSLATION_AUTO;
if (!dev->conf.cyls && !dev->conf.heads && !dev->conf.secs) {
/* try to fall back to value set with legacy -drive cyls=... */
dinfo = drive_get_by_blockdev(dev->conf.bs);
dev->conf.cyls = dinfo->cyls;
dev->conf.heads = dinfo->heads;
dev->conf.secs = dinfo->secs;
- trans = dinfo->trans;
+ dev->chs_trans = dinfo->trans;
}
if (!dev->conf.cyls && !dev->conf.heads && !dev->conf.secs) {
hd_geometry_guess(dev->conf.bs,
&dev->conf.cyls, &dev->conf.heads, &dev->conf.secs,
- &trans);
+ &dev->chs_trans);
}
if (ide_init_drive(s, dev->conf.bs, kind,
dev->version, serial, dev->model, dev->wwn,
dev->conf.cyls, dev->conf.heads, dev->conf.secs,
- trans) < 0) {
+ dev->chs_trans) < 0) {
return -1;
}
@@ -222,6 +220,8 @@ static int ide_drive_initfn(IDEDevice *dev)
static Property ide_hd_properties[] = {
DEFINE_IDE_DEV_PROPERTIES(),
DEFINE_BLOCK_CHS_PROPERTIES(IDEDrive, dev.conf),
+ DEFINE_PROP_BIOS_CHS_TRANS("bios-chs-trans",
+ IDEDrive, dev.chs_trans, BIOS_ATA_TRANSLATION_AUTO),
DEFINE_PROP_END_OF_LIST(),
};
--
1.7.6.5
- [Qemu-devel] [PATCH 16/41] qdev: Introduce block geometry properties, (continued)
- [Qemu-devel] [PATCH 16/41] qdev: Introduce block geometry properties, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 14/41] ide pc: Cut out the block layer geometry middleman, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 29/41] hd-geometry: Compute BIOS CHS translation in one place, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 22/41] qdev: Collect private helpers in one place, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 33/41] hw/block-common: Factor out fall back to legacy -drive serial=..., Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 30/41] blockdev: Drop redundant CHS validation for if=ide, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 27/41] ide pc: Put hard disk info into CMOS only for hard disks, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 31/41] Relax IDE CHS limits from 16383, 16, 63 to 65535, 16, 255, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 41/41] fdc-test: Clean up a bit, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 37/41] coroutine-ucontext: Help valgrind understand coroutines, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 24/41] ide: qdev property for BIOS CHS translation,
Kevin Wolf <=
- [Qemu-devel] [PATCH 25/41] qtest: Cover qdev property for BIOS CHS translation, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 18/41] scsi-hd: qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 26/41] block: Geometry and translation hints are now useless, purge them, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 32/41] hw/block-common: Move BlockConf & friends from block.h, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 38/41] qemu-iotests: Valgrind support, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 28/41] qtest: Test we don't put hard disk info into CMOS for a CD-ROM, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 34/41] blockdev: Don't limit DriveInfo serial to 20 characters, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 12/41] hd-geometry: Clean up confusing use of prior translation hint, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 21/41] qtest: Cover qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 23/41] qdev: New property type chs-translation, Kevin Wolf, 2012/07/17