mirror of https://github.com/xemu-project/xemu.git
ide: Add "ide-cf" driver, a CompactFlash card
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> Message-Id: <20221130120319.706885-1-lkundrak@v3.sk> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
1ea17d228e
commit
cec79db38d
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue