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