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