Lines Matching +full:- +full:chs

22 #include "qapi/qapi-types-block.h"
23 #include "qemu/error-report.h"
25 #include "hw/ide/ide-dev.h"
26 #include "system/block-backend.h"
30 #include "ide-internal.h"
33 DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
34 DEFINE_PROP_BOOL("win2k-install-hack", IDEDevice, win2k_install_hack, false),
41 IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus); in ide_qdev_realize()
43 if (dev->unit == -1) { in ide_qdev_realize()
44 dev->unit = bus->master ? 1 : 0; in ide_qdev_realize()
47 if (dev->unit >= bus->max_units) { in ide_qdev_realize()
49 dev->unit, bus->max_units); in ide_qdev_realize()
53 switch (dev->unit) { in ide_qdev_realize()
55 if (bus->master) { in ide_qdev_realize()
56 error_setg(errp, "IDE unit %d is in use", dev->unit); in ide_qdev_realize()
59 bus->master = dev; in ide_qdev_realize()
62 if (bus->slave) { in ide_qdev_realize()
63 error_setg(errp, "IDE unit %d is in use", dev->unit); in ide_qdev_realize()
66 bus->slave = dev; in ide_qdev_realize()
69 error_setg(errp, "Invalid IDE unit %d", dev->unit); in ide_qdev_realize()
72 dc->realize(dev, errp); in ide_qdev_realize()
77 IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus); in ide_dev_initfn()
78 IDEState *s = bus->ifs + dev->unit; in ide_dev_initfn()
81 if (!dev->conf.blk) { in ide_dev_initfn()
87 dev->conf.blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL); in ide_dev_initfn()
88 ret = blk_attach_dev(dev->conf.blk, &dev->qdev); in ide_dev_initfn()
93 if (dev->conf.discard_granularity == -1) { in ide_dev_initfn()
94 dev->conf.discard_granularity = 512; in ide_dev_initfn()
95 } else if (dev->conf.discard_granularity && in ide_dev_initfn()
96 dev->conf.discard_granularity != 512) { in ide_dev_initfn()
101 if (!blkconf_blocksizes(&dev->conf, errp)) { in ide_dev_initfn()
105 if (dev->conf.logical_block_size != 512) { in ide_dev_initfn()
111 if (!blkconf_geometry(&dev->conf, &dev->chs_trans, 65535, 16, 255, in ide_dev_initfn()
116 if (!blkconf_apply_backend_options(&dev->conf, kind == IDE_CD, in ide_dev_initfn()
125 if (!dev->version) { in ide_dev_initfn()
126 dev->version = g_strdup(s->version); in ide_dev_initfn()
128 if (!dev->serial) { in ide_dev_initfn()
129 dev->serial = g_strdup(s->drive_serial_str); in ide_dev_initfn()
132 add_boot_device_path(dev->conf.bootindex, &dev->qdev, in ide_dev_initfn()
133 dev->unit ? "/disk@1" : "/disk@0"); in ide_dev_initfn()
135 add_boot_device_lchs(&dev->qdev, dev->unit ? "/disk@1" : "/disk@0", in ide_dev_initfn()
136 dev->conf.lcyls, in ide_dev_initfn()
137 dev->conf.lheads, in ide_dev_initfn()
138 dev->conf.lsecs); in ide_dev_initfn()
146 visit_type_int32(v, name, &d->conf.bootindex, errp); in ide_dev_get_bootindex()
165 d->conf.bootindex = boot_index; in ide_dev_set_bootindex()
167 if (d->unit != -1) { in ide_dev_set_bootindex()
168 add_boot_device_path(d->conf.bootindex, &d->qdev, in ide_dev_set_bootindex()
169 d->unit ? "/disk@1" : "/disk@0"); in ide_dev_set_bootindex()
180 object_property_set_int(obj, "bootindex", -1, NULL); in ide_dev_instance_init()
196 DEFINE_PROP_BIOS_CHS_TRANS("bios-chs-trans",
206 k->realize = ide_hd_realize; in ide_hd_class_init()
207 dc->fw_name = "drive"; in ide_hd_class_init()
208 dc->desc = "virtual IDE disk"; in ide_hd_class_init()
213 .name = "ide-hd",
228 k->realize = ide_cd_realize; in ide_cd_class_init()
229 dc->fw_name = "drive"; in ide_cd_class_init()
230 dc->desc = "virtual IDE CD-ROM"; in ide_cd_class_init()
235 .name = "ide-cd",
244 k->realize = ide_qdev_realize; in ide_device_class_init()
245 set_bit(DEVICE_CATEGORY_STORAGE, k->categories); in ide_device_class_init()
246 k->bus_type = TYPE_IDE_BUS; in ide_device_class_init()