From: Roman Kagan <rkagan@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
qemu-block@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
qemu-stable@nongnu.org, Roman Kagan <rkagan@virtuozzo.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Igor Mammedov <imammedo@redhat.com>, John Snow <jsnow@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v4 3/4] expose floppy drive geometry and CMOS type
Date: Fri, 25 Dec 2015 18:04:11 +0300 [thread overview]
Message-ID: <1451055852-30910-4-git-send-email-rkagan@virtuozzo.com> (raw)
In-Reply-To: <1451055852-30910-1-git-send-email-rkagan@virtuozzo.com>
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 <rkagan@virtuozzo.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: qemu-block@nongnu.org
Cc: qemu-stable@nongnu.org
---
changes since v3:
- split out into a separate patch to faciliate review
hw/block/fdc.c | 11 +++++++++++
hw/i386/pc.c | 2 +-
include/hw/block/fdc.h | 2 ++
include/hw/i386/pc.h | 1 +
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 4292ece..c858c5f 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2408,6 +2408,17 @@ FDriveType 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 c36b8cf..99fab83 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -199,7 +199,7 @@ static void pic_irq_request(void *opaque, int irq, int level)
#define REG_EQUIPMENT_BYTE 0x14
-static int cmos_get_fd_drive_type(FDriveType fd0)
+int cmos_get_fd_drive_type(FDriveType fd0)
{
int val;
diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h
index d48b2f8..adaf3dc 100644
--- a/include/hw/block/fdc.h
+++ b/include/hw/block/fdc.h
@@ -22,5 +22,7 @@ void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
DriveInfo **fds, qemu_irq *fdc_tc);
FDriveType 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 8122229..d044a9a 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -268,6 +268,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(FDriveType fd0);
/* acpi_piix.c */
--
2.5.0
next prev parent reply other threads:[~2015-12-25 15:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-25 15:04 [Qemu-devel] [PATCH v4 0/4] i386: expose floppy-related objects in SSDT Roman Kagan
2015-12-25 15:04 ` [Qemu-devel] [PATCH v4 1/4] i386/pc: expose identifying the floppy controller Roman Kagan
2015-12-25 15:04 ` [Qemu-devel] [PATCH v4 2/4] i386/acpi: make floppy controller object dynamic Roman Kagan
2015-12-25 15:04 ` Roman Kagan [this message]
2015-12-25 15:04 ` [Qemu-devel] [PATCH v4 4/4] i386: populate floppy drive information in SSDT Roman Kagan
2015-12-29 14:09 ` [Qemu-devel] [PATCH v4 0/4] i386: expose floppy-related objects " Igor Mammedov
2015-12-29 16:17 ` Roman Kagan
2015-12-29 16:27 ` Igor Mammedov
2015-12-29 16:42 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2015-12-16 7:45 [Qemu-devel] [PATCH v2 1/1] " Denis V. Lunev
2015-12-16 16:46 ` John Snow
2015-12-16 16:46 ` Igor Mammedov
2015-12-16 17:34 ` Roman Kagan
2015-12-16 22:15 ` Igor Mammedov
2015-12-17 13:26 ` Roman Kagan
2015-12-17 17:08 ` Igor Mammedov
2015-12-18 19:32 ` [Qemu-devel] [PATCH v3 0/2] " Roman Kagan
2015-12-18 19:32 ` [Qemu-devel] [PATCH v3 1/2] " Roman Kagan
2015-12-22 15:07 ` Michael S. Tsirkin
2015-12-22 15:13 ` Roman Kagan
2015-12-22 15:56 ` Igor Mammedov
2015-12-18 19:32 ` [Qemu-devel] [PATCH v3 2/2] tests: update expected SSDT for floppy changes Roman Kagan
2015-12-22 16:41 ` Michael S. Tsirkin
2015-12-23 13:08 ` Roman Kagan
2015-12-23 13:45 ` Michael S. Tsirkin
2015-12-23 15:06 ` Roman Kagan
2015-12-23 17:20 ` Roman Kagan
2015-12-23 17:47 ` Igor Mammedov
2015-12-23 17:51 ` Roman Kagan
2015-12-24 6:17 ` Michael S. Tsirkin
2015-12-25 15:25 ` Roman Kagan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1451055852-30910-4-git-send-email-rkagan@virtuozzo.com \
--to=rkagan@virtuozzo.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).