[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 55/59] i386/pc: expose identifying the floppy cont
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 55/59] i386/pc: expose identifying the floppy controller |
Date: |
Sat, 9 Jan 2016 23:42:07 +0200 |
From: Roman Kagan <address@hidden>
Factor out and expose the function to locate the floppy controller in
the system.
It will allow to dynamically populate the relevant objects in the ACPI
tables.
Signed-off-by: Roman Kagan <address@hidden>
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Igor Mammedov <address@hidden>
Cc: John Snow <address@hidden>
Cc: Kevin Wolf <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: address@hidden
Cc: address@hidden
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/i386/pc.h | 2 ++
hw/i386/pc.c | 44 ++++++++++++++++++++++++++------------------
2 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index b0d6283..8122229 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -267,6 +267,8 @@ 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);
+
/* acpi_piix.c */
I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 459260b..c36b8cf 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -360,6 +360,31 @@ static const char * const fdc_container_path[] = {
"/unattached", "/peripheral", "/peripheral-anon"
};
+/*
+ * Locate the FDC at IO address 0x3f0, in order to configure the CMOS registers
+ * and ACPI objects.
+ */
+ISADevice *pc_find_fdc0(void)
+{
+ int i;
+ Object *container;
+ CheckFdcState state = { 0 };
+
+ for (i = 0; i < ARRAY_SIZE(fdc_container_path); i++) {
+ container = container_get(qdev_get_machine(), fdc_container_path[i]);
+ object_child_foreach(container, check_fdc, &state);
+ }
+
+ if (state.multiple) {
+ error_report("warning: multiple floppy disk controllers with "
+ "iobase=0x3f0 have been found;\n"
+ "the one being picked for CMOS setup might not reflect "
+ "your intent");
+ }
+
+ return state.floppy;
+}
+
static void pc_cmos_init_late(void *opaque)
{
pc_cmos_init_late_arg *arg = opaque;
@@ -368,8 +393,6 @@ static void pc_cmos_init_late(void *opaque)
int8_t heads, sectors;
int val;
int i, trans;
- Object *container;
- CheckFdcState state = { 0 };
val = 0;
if (ide_get_geometry(arg->idebus[0], 0,
@@ -399,22 +422,7 @@ static void pc_cmos_init_late(void *opaque)
}
rtc_set_memory(s, 0x39, val);
- /*
- * Locate the FDC at IO address 0x3f0, and configure the CMOS registers
- * accordingly.
- */
- for (i = 0; i < ARRAY_SIZE(fdc_container_path); i++) {
- container = container_get(qdev_get_machine(), fdc_container_path[i]);
- object_child_foreach(container, check_fdc, &state);
- }
-
- if (state.multiple) {
- error_report("warning: multiple floppy disk controllers with "
- "iobase=0x3f0 have been found;\n"
- "the one being picked for CMOS setup might not reflect "
- "your intent");
- }
- pc_cmos_init_floppy(s, state.floppy);
+ pc_cmos_init_floppy(s, pc_find_fdc0());
qemu_unregister_reset(pc_cmos_init_late, opaque);
}
--
MST
- [Qemu-devel] [PULL v2 44/59] pc: acpi: q35: move IQST() into SSDT, (continued)
- [Qemu-devel] [PULL v2 44/59] pc: acpi: q35: move IQST() into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 46/59] pc: acpi: q35: move _PRT() into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 45/59] pc: acpi: q35: move ISA bridge into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 47/59] pc: acpi: q35: move PRTA routing table into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 49/59] pc: acpi: q35: move _PIC() method into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 48/59] pc: acpi: q35: move PRTP routing table into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 50/59] pc: acpi: q35: move PCI0._OSC() method into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 51/59] pc: acpi: q35: move PCI0 device definition into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 52/59] pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 53/59] pc: acpi: switch to AML API composed DSDT, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 55/59] i386/pc: expose identifying the floppy controller,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 56/59] Add VMSTATE_STRUCT_VARRAY_KNOWN, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 57/59] migration/virtio: Remove simple .get/.put use, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 58/59] ivshmem: Store file descriptor for vhost-user negotiation, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 59/59] virtio: fix error message for number of queues, Michael S. Tsirkin, 2016/01/09
- [Qemu-devel] [PULL v2 54/59] pc: acpi: remove unused ASL templates and related blobs/utils, Michael S. Tsirkin, 2016/01/09
- Re: [Qemu-devel] [PULL v2 00/59] acpi dsdt rework, misc fixes, Peter Maydell, 2016/01/11