| 1 | /* |
| 2 | * ide CompactFlash support |
| 3 | * |
| 4 | * This code is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2.1 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #include "qemu/osdep.h" |
| 19 | #include "hw/ide/ide-dev.h" |
| 20 | #include "qapi/qapi-types-block.h" |
| 21 | |
| 22 | static void ide_cf_realize(IDEDevice *dev, Error **errp) |
| 23 | { |
| 24 | ide_dev_initfn(dev, IDE_CFATA, errp); |
| 25 | } |
| 26 | |
| 27 | static const Property ide_cf_properties[] = { |
| 28 | DEFINE_IDE_DEV_PROPERTIES(), |
| 29 | DEFINE_BLOCK_CHS_PROPERTIES(IDEDrive, dev.conf), |
| 30 | DEFINE_PROP_BIOS_CHS_TRANS("bios-chs-trans", |
| 31 | IDEDrive, dev.chs_trans, BIOS_ATA_TRANSLATION_AUTO), |
| 32 | }; |
| 33 | |
| 34 | static void ide_cf_class_init(ObjectClass *klass, const void *data) |
| 35 | { |
| 36 | DeviceClass *dc = DEVICE_CLASS(klass); |
| 37 | IDEDeviceClass *k = IDE_DEVICE_CLASS(klass); |
| 38 | |
| 39 | k->realize = ide_cf_realize; |
| 40 | dc->fw_name = "drive"; |
| 41 | dc->desc = "virtual CompactFlash card"; |
| 42 | device_class_set_props(dc, ide_cf_properties); |
| 43 | } |
| 44 | |
| 45 | static const TypeInfo ide_cf_info = { |
| 46 | .name = "ide-cf", |
| 47 | .parent = TYPE_IDE_DEVICE, |
| 48 | .instance_size = sizeof(IDEDrive), |
| 49 | .class_init = ide_cf_class_init, |
| 50 | }; |
| 51 | |
| 52 | static void ide_cf_register_type(void) |
| 53 | { |
| 54 | type_register_static(&ide_cf_info); |
| 55 | } |
| 56 | |
| 57 | type_init(ide_cf_register_type) |