[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 31/36] fdc: Add lock-mode qdev properties
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v8 31/36] fdc: Add lock-mode qdev properties |
Date: |
Fri, 30 Sep 2016 20:10:01 +0800 |
Signed-off-by: Fam Zheng <address@hidden>
---
hw/block/fdc.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index b79873a..20684b8 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -158,6 +158,7 @@ typedef enum FDiskFlags {
typedef struct FDrive {
FDCtrl *fdctrl;
BlockBackend *blk;
+ ImageLockMode lock_mode;
/* Drive status */
FloppyDriveType drive; /* CMOS drive type */
uint8_t perpendicular; /* 2.88 MB access mode */
@@ -2446,11 +2447,23 @@ static void fdctrl_realize_common(FDCtrl *fdctrl, Error
**errp)
{
int i, j;
static int command_tables_inited = 0;
+ Error *local_err = NULL;
if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) {
error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'");
}
+ for (i = 0; i < 2; ++i) {
+ if (fdctrl->drives[i].blk) {
+ blk_lock_image(fdctrl->drives[i].blk, fdctrl->drives[i].lock_mode,
+ &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+ }
+ }
+
/* Fill 'command_to_handler' lookup table */
if (!command_tables_inited) {
command_tables_inited = 1;
@@ -2495,7 +2508,6 @@ static void isabus_fdc_realize(DeviceState *dev, Error
**errp)
FDCtrlISABus *isa = ISA_FDC(dev);
FDCtrl *fdctrl = &isa->state;
Error *err = NULL;
-
isa_register_portio_list(isadev, &fdctrl->portio_list,
isa->iobase, fdc_portio_list, fdctrl,
"fdc");
@@ -2608,6 +2620,8 @@ static Property isa_fdc_properties[] = {
DEFINE_PROP_UINT32("dma", FDCtrlISABus, dma, 2),
DEFINE_PROP_DRIVE("driveA", FDCtrlISABus, state.drives[0].blk),
DEFINE_PROP_DRIVE("driveB", FDCtrlISABus, state.drives[1].blk),
+ DEFINE_PROP_LOCK_MODE("lock-modeA", FDCtrlISABus,
state.drives[0].lock_mode),
+ DEFINE_PROP_LOCK_MODE("lock-modeB", FDCtrlISABus,
state.drives[1].lock_mode),
DEFINE_PROP_BIT("check_media_rate", FDCtrlISABus, state.check_media_rate,
0, true),
DEFINE_PROP_DEFAULT("fdtypeA", FDCtrlISABus, state.drives[0].drive,
@@ -2667,6 +2681,8 @@ static const VMStateDescription vmstate_sysbus_fdc ={
static Property sysbus_fdc_properties[] = {
DEFINE_PROP_DRIVE("driveA", FDCtrlSysBus, state.drives[0].blk),
DEFINE_PROP_DRIVE("driveB", FDCtrlSysBus, state.drives[1].blk),
+ DEFINE_PROP_LOCK_MODE("lock-modeA", FDCtrlISABus,
state.drives[0].lock_mode),
+ DEFINE_PROP_LOCK_MODE("lock-modeB", FDCtrlISABus,
state.drives[1].lock_mode),
DEFINE_PROP_DEFAULT("fdtypeA", FDCtrlSysBus, state.drives[0].drive,
FLOPPY_DRIVE_TYPE_AUTO, qdev_prop_fdc_drive_type,
FloppyDriveType),
@@ -2696,6 +2712,7 @@ static const TypeInfo sysbus_fdc_info = {
static Property sun4m_fdc_properties[] = {
DEFINE_PROP_DRIVE("drive", FDCtrlSysBus, state.drives[0].blk),
+ DEFINE_PROP_LOCK_MODE("lock-mode", FDCtrlISABus,
state.drives[0].lock_mode),
DEFINE_PROP_DEFAULT("fdtype", FDCtrlSysBus, state.drives[0].drive,
FLOPPY_DRIVE_TYPE_AUTO, qdev_prop_fdc_drive_type,
FloppyDriveType),
--
2.7.4
- [Qemu-devel] [PATCH v8 21/36] qemu-iotests: 091: Prepare for image lock, (continued)
- [Qemu-devel] [PATCH v8 21/36] qemu-iotests: 091: Prepare for image lock, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 22/36] qemu-iotests: 030: Disable image locking when checking test image, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 23/36] iotests: 087: Disable image locking in cases where file is shared, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 24/36] iotests: 087: Disable image locking in cases where file is shared, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 25/36] iotests: 130: Check image info locklessly, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 26/36] iotests: Disable image locking in 085, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 27/36] tests: Use null-co:// instead of /dev/null, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 28/36] qemu-iotests: Add test case 153 for image locking, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 29/36] ahci: Use shared lock for shared storage migration, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 30/36] tests/postcopy: Use shared lock for images, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 31/36] fdc: Add lock-mode qdev properties,
Fam Zheng <=
- [Qemu-devel] [PATCH v8 32/36] m25p80: Add 'lock-mode' property, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 33/36] nand: Add 'lock-mode' property, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 34/36] onenand: Add 'lock-mode' property, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 35/36] spapr_nvram: Add 'lock-mode' property, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 36/36] sd: Add 'lock-mode' property, Fam Zheng, 2016/09/30