xref: /openbmc/qemu/hw/ide/cf.c (revision 33a24910)
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 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     DEFINE_PROP_END_OF_LIST(),
33 };
34 
35 static void ide_cf_class_init(ObjectClass *klass, void *data)
36 {
37     DeviceClass *dc = DEVICE_CLASS(klass);
38     IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
39 
40     k->realize  = ide_cf_realize;
41     dc->fw_name = "drive";
42     dc->desc    = "virtual CompactFlash card";
43     device_class_set_props(dc, ide_cf_properties);
44 }
45 
46 static const TypeInfo ide_cf_info = {
47     .name          = "ide-cf",
48     .parent        = TYPE_IDE_DEVICE,
49     .instance_size = sizeof(IDEDrive),
50     .class_init    = ide_cf_class_init,
51 };
52 
53 static void ide_cf_register_type(void)
54 {
55     type_register_static(&ide_cf_info);
56 }
57 
58 type_init(ide_cf_register_type)
59