cf.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include "qemu/osdep.h"
  18. #include "hw/ide/ide-dev.h"
  19. #include "qapi/qapi-types-block.h"
  20. static void ide_cf_realize(IDEDevice *dev, Error **errp)
  21. {
  22. ide_dev_initfn(dev, IDE_CFATA, errp);
  23. }
  24. static const Property ide_cf_properties[] = {
  25. DEFINE_IDE_DEV_PROPERTIES(),
  26. DEFINE_BLOCK_CHS_PROPERTIES(IDEDrive, dev.conf),
  27. DEFINE_PROP_BIOS_CHS_TRANS("bios-chs-trans",
  28. IDEDrive, dev.chs_trans, BIOS_ATA_TRANSLATION_AUTO),
  29. };
  30. static void ide_cf_class_init(ObjectClass *klass, void *data)
  31. {
  32. DeviceClass *dc = DEVICE_CLASS(klass);
  33. IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
  34. k->realize = ide_cf_realize;
  35. dc->fw_name = "drive";
  36. dc->desc = "virtual CompactFlash card";
  37. device_class_set_props(dc, ide_cf_properties);
  38. }
  39. static const TypeInfo ide_cf_info = {
  40. .name = "ide-cf",
  41. .parent = TYPE_IDE_DEVICE,
  42. .instance_size = sizeof(IDEDrive),
  43. .class_init = ide_cf_class_init,
  44. };
  45. static void ide_cf_register_type(void)
  46. {
  47. type_register_static(&ide_cf_info);
  48. }
  49. type_init(ide_cf_register_type)