* [RESEND PATCH] ide: Add "ide-cf" driver, a CompactFlash card
@ 2022-11-30 12:03 Lubomir Rintel
2022-11-30 13:52 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Lubomir Rintel @ 2022-11-30 12:03 UTC (permalink / raw)
To: John Snow; +Cc: qemu-block, qemu-devel, Lubomir Rintel
This allows attaching IDE_CFATA device to an IDE bus. Behaves like a
CompactFlash card in True IDE mode.
Tested with:
qemu-system-i386 \
-device driver=ide-cf,drive=cf,bus=ide.0 \
-drive id=cf,index=0,format=raw,if=none,file=cf.img
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
hw/ide/qdev.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 618045b85a..6f6c7462f3 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -283,6 +283,11 @@ static void ide_cd_realize(IDEDevice *dev, Error **errp)
ide_dev_initfn(dev, IDE_CD, errp);
}
+static void ide_cf_realize(IDEDevice *dev, Error **errp)
+{
+ ide_dev_initfn(dev, IDE_CFATA, errp);
+}
+
#define DEFINE_IDE_DEV_PROPERTIES() \
DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \
DEFINE_BLOCK_ERROR_PROPERTIES(IDEDrive, dev.conf), \
@@ -341,6 +346,32 @@ static const TypeInfo ide_cd_info = {
.class_init = ide_cd_class_init,
};
+static Property ide_cf_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(),
+};
+
+static void ide_cf_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
+
+ k->realize = ide_cf_realize;
+ dc->fw_name = "drive";
+ dc->desc = "virtual CompactFlash card";
+ device_class_set_props(dc, ide_cf_properties);
+}
+
+static const TypeInfo ide_cf_info = {
+ .name = "ide-cf",
+ .parent = TYPE_IDE_DEVICE,
+ .instance_size = sizeof(IDEDrive),
+ .class_init = ide_cf_class_init,
+};
+
static void ide_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *k = DEVICE_CLASS(klass);
@@ -365,6 +396,7 @@ static void ide_register_types(void)
type_register_static(&ide_bus_info);
type_register_static(&ide_hd_info);
type_register_static(&ide_cd_info);
+ type_register_static(&ide_cf_info);
type_register_static(&ide_device_type_info);
}
--
2.37.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND PATCH] ide: Add "ide-cf" driver, a CompactFlash card
2022-11-30 12:03 [RESEND PATCH] ide: Add "ide-cf" driver, a CompactFlash card Lubomir Rintel
@ 2022-11-30 13:52 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-11-30 13:52 UTC (permalink / raw)
To: Lubomir Rintel; +Cc: John Snow, qemu-block, qemu-devel
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-30 13:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 12:03 [RESEND PATCH] ide: Add "ide-cf" driver, a CompactFlash card Lubomir Rintel
2022-11-30 13:52 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).