[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 07/10] fdc: add disk field
From: |
John Snow |
Subject: |
[Qemu-devel] [RFC 07/10] fdc: add disk field |
Date: |
Tue, 30 Jun 2015 21:20:37 -0400 |
Allows us to distinguish between the current DISK type and the current
DRIVE type. The DRIVE is what's reported to CMOS, the DISK is whatever
the revalidate function suspects has been inserted into the drive.
The 'drive' field maintains the same meaning as it did previously, however,
the revalidate function will no longer update the "drive" field once it has
been changed away from FDRIVE_DRV_NONE, opting to only update the "disk" field
instead.
This should have no impact on the current pick_geometry algorithm, because
it is already incapable of choosing a new drive type after initial setup.
Thus, as of this patch, disk and drive will always be the same.
Disk does not need to be migrated because it is not user-visible state nor
is it currently used for any calculations. It is purely informative, and
will be rebuilt automatically via fd_revalidate on the new host.
Signed-off-by: John Snow <address@hidden>
---
hw/block/fdc.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 6e5f87b..92c81eb 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -154,7 +154,8 @@ typedef struct FDrive {
FDCtrl *fdctrl;
BlockBackend *blk;
/* Drive status */
- FDriveType drive;
+ FDriveType drive; /* CMOS drive type */
+ FDriveType disk; /* Current disk type */
uint8_t perpendicular; /* 2.88 MB access mode */
/* Position */
uint8_t head;
@@ -174,6 +175,7 @@ static void fd_init(FDrive *drv)
{
/* Drive */
drv->drive = FDRIVE_DRV_NONE;
+ drv->disk = FDRIVE_DRV_NONE;
drv->perpendicular = 0;
/* Disk */
drv->last_sect = 0;
@@ -316,7 +318,10 @@ static void pick_geometry(FDrive *drv, int *nb_heads)
*nb_heads = parse->max_head + 1;
drv->max_track = parse->max_track;
drv->last_sect = parse->last_sect;
- drv->drive = parse->drive;
+ if (drv->drive == FDRIVE_DRV_NONE) {
+ drv->drive = parse->drive;
+ }
+ drv->disk = parse->drive;
drv->media_rate = parse->rate;
}
--
2.1.0
- [Qemu-devel] [RFC 00/10] fix 2.88mb floppy diskette support, John Snow, 2015/06/30
- [Qemu-devel] [RFC 03/10] fdc: respect default drive type, John Snow, 2015/06/30
- [Qemu-devel] [RFC 01/10] fdc: Make default FDrive type explicit, John Snow, 2015/06/30
- [Qemu-devel] [RFC 04/10] fdc: move pick_geometry, John Snow, 2015/06/30
- [Qemu-devel] [RFC 06/10] fdc: add physical disk sizes, John Snow, 2015/06/30
- [Qemu-devel] [RFC 05/10] fdc: refactor pick_geometry, John Snow, 2015/06/30
- [Qemu-devel] [RFC 07/10] fdc: add disk field,
John Snow <=
- [Qemu-devel] [RFC 02/10] fdc: add default drive type option, John Snow, 2015/06/30
- [Qemu-devel] [RFC 09/10] qtest/fdc: Support for 2.88MB drives, John Snow, 2015/06/30
- [Qemu-devel] [RFC 10/10] fdc: change default drive to 288, John Snow, 2015/06/30
- [Qemu-devel] [RFC 08/10] fdc: refactor pick_geometry, John Snow, 2015/06/30