[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 47/49] expose floppy drive geometry and CMOS type
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 47/49] expose floppy drive geometry and CMOS type |
Date: |
Thu, 4 Feb 2016 23:54:08 +0200 |
From: Roman Kagan <address@hidden>
Make it possible to query the geometry and the CMOS type of a floppy
drive outside of the respective source files.
It will be useful, in particular, when dynamically building ACPI tables,
and will allow to properly populate the corresponding ACPI objects and
thus enable BIOS-less systems to access the floppy drives.
Signed-off-by: Roman Kagan <address@hidden>
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/block/fdc.h | 2 ++
include/hw/i386/pc.h | 1 +
hw/block/fdc.c | 11 +++++++++++
hw/i386/pc.c | 2 +-
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h
index adce14f..d87859e 100644
--- a/include/hw/block/fdc.h
+++ b/include/hw/block/fdc.h
@@ -15,5 +15,7 @@ void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
DriveInfo **fds, qemu_irq *fdc_tc);
FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i);
+void isa_fdc_get_drive_geometry(ISADevice *fdc, int i, uint8_t *cylinders,
+ uint8_t *heads, uint8_t *sectors);
#endif
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8b3546e..472754c 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -265,6 +265,7 @@ typedef void (*cpu_set_smm_t)(int smm, void *arg);
void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
ISADevice *pc_find_fdc0(void);
+int cmos_get_fd_drive_type(FloppyDriveType fd0);
/* acpi_piix.c */
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 818e8a4..245184b 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2509,6 +2509,17 @@ FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc,
int i)
return isa->state.drives[i].drive;
}
+void isa_fdc_get_drive_geometry(ISADevice *fdc, int i, uint8_t *cylinders,
+ uint8_t *heads, uint8_t *sectors)
+{
+ FDCtrlISABus *isa = ISA_FDC(fdc);
+ FDrive *drv = &isa->state.drives[i];
+
+ *cylinders = drv->max_track;
+ *heads = (drv->flags & FDISK_DBL_SIDES) ? 2 : 1;
+ *sectors = drv->last_sect;
+}
+
static const VMStateDescription vmstate_isa_fdc ={
.name = "fdc",
.version_id = 2,
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index ce185bb..fd8524f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -200,7 +200,7 @@ static void pic_irq_request(void *opaque, int irq, int
level)
#define REG_EQUIPMENT_BYTE 0x14
-static int cmos_get_fd_drive_type(FloppyDriveType fd0)
+int cmos_get_fd_drive_type(FloppyDriveType fd0)
{
int val;
--
MST
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, (continued)
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, Roman Kagan, 2016/02/10
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, Roman Kagan, 2016/02/10
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, John Snow, 2016/02/10
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, Roman Kagan, 2016/02/10
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, John Snow, 2016/02/10
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, Kevin O'Connor, 2016/02/13
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, Laszlo Ersek, 2016/02/14
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, Michael S. Tsirkin, 2016/02/14
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, Roman Kagan, 2016/02/17
- Re: [Qemu-devel] [PULL 48/49] i386: populate floppy drive information in DSDT, Roman Kagan, 2016/02/10
[Qemu-devel] [PULL 47/49] expose floppy drive geometry and CMOS type,
Michael S. Tsirkin <=
[Qemu-devel] [PULL 49/49] acpi: update expected DSDT, Michael S. Tsirkin, 2016/02/04
Re: [Qemu-devel] [PULL 00/49] pc and misc cleanups and fixes, virtio optimizations, Peter Maydell, 2016/02/05