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 v5 2/6] i386/acpi: make floppy controller object dynamic
Date: Wed, 30 Dec 2015 23:11:52 +0300 [thread overview]
Message-ID: <1451506316-31975-3-git-send-email-rkagan@virtuozzo.com> (raw)
In-Reply-To: <1451506316-31975-1-git-send-email-rkagan@virtuozzo.com>
Instead of statically declaring the floppy controller in DSDT, with its
_STA method depending on some obscure bit in the parent ISA bridge, add
the object dynamically to SSDT via AML API only when the controller is
present.
The _STA method is no longer necessary and is therefore dropped. So are
the declarations of the fields indicating whether the contoller is
enabled.
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 v4:
- re-split from test data update to facilitate review (bisectability not
affected)
changes since v3:
- new patch (note that it conflicts with "[PATCH 50/74] pc: acpi: move
FDC0 device from DSDT to SSDT" from Igor's series)
- include test data updates to maintain bisectability
hw/i386/acpi-build.c | 24 ++++++++++++++++++++++++
hw/i386/acpi-dsdt-isa.dsl | 18 ------------------
hw/i386/acpi-dsdt.dsl | 1 -
hw/i386/q35-acpi-dsdt.dsl | 7 ++-----
4 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4cc1440..a01e909 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -113,6 +113,7 @@ typedef struct AcpiMiscInfo {
unsigned dsdt_size;
uint16_t pvpanic_port;
uint16_t applesmc_io_base;
+ bool has_fdc;
} AcpiMiscInfo;
typedef struct AcpiBuildPciBusHotplugState {
@@ -236,10 +237,15 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
static void acpi_get_misc_info(AcpiMiscInfo *info)
{
+ ISADevice *fdc;
+
info->has_hpet = hpet_find();
info->tpm_version = tpm_get_version();
info->pvpanic_port = pvpanic_port();
info->applesmc_io_base = applesmc_port();
+
+ fdc = pc_find_fdc0();
+ info->has_fdc = !!fdc;
}
/*
@@ -1099,6 +1105,24 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_append(scope, aml_name_decl("_S5", pkg));
aml_append(ssdt, scope);
+ if (misc->has_fdc) {
+ scope = aml_scope("\\_SB.PCI0.ISA");
+ dev = aml_device("FDC0");
+
+ aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0700")));
+
+ crs = aml_resource_template();
+ aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04));
+ aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01));
+ aml_append(crs, aml_irq_no_flags(6));
+ aml_append(crs, aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER,
+ AML_TRANSFER8, 2));
+ aml_append(dev, aml_name_decl("_CRS", crs));
+
+ aml_append(scope, dev);
+ aml_append(ssdt, scope);
+ }
+
if (misc->applesmc_io_base) {
scope = aml_scope("\\_SB.PCI0.ISA");
dev = aml_device("SMC");
diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
index 89caa16..061507d 100644
--- a/hw/i386/acpi-dsdt-isa.dsl
+++ b/hw/i386/acpi-dsdt-isa.dsl
@@ -47,24 +47,6 @@ Scope(\_SB.PCI0.ISA) {
})
}
- Device(FDC0) {
- Name(_HID, EisaId("PNP0700"))
- Method(_STA, 0, NotSerialized) {
- Store(FDEN, Local0)
- If (LEqual(Local0, 0)) {
- Return (0x00)
- } Else {
- Return (0x0F)
- }
- }
- Name(_CRS, ResourceTemplate() {
- IO(Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
- IO(Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
- IRQNoFlags() { 6 }
- DMA(Compatibility, NotBusMaster, Transfer8) { 2 }
- })
- }
-
Device(LPT) {
Name(_HID, EisaId("PNP0400"))
Method(_STA, 0, NotSerialized) {
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 8dba096..aa50990 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -80,7 +80,6 @@ DefinitionBlock (
, 3,
CBEN, 1, // COM2
}
- Name(FDEN, 1)
}
}
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 7be7b37..fcb9915 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -137,16 +137,13 @@ DefinitionBlock (
COMB, 3,
Offset(0x01),
- LPTD, 2,
- , 2,
- FDCD, 2
+ LPTD, 2
}
OperationRegion(LPCE, PCI_Config, 0x82, 0x2)
Field(LPCE, AnyAcc, NoLock, Preserve) {
CAEN, 1,
CBEN, 1,
- LPEN, 1,
- FDEN, 1
+ LPEN, 1
}
}
}
--
2.5.0
next prev parent reply other threads:[~2015-12-30 20:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-30 20:11 [Qemu-devel] [PATCH v5 0/6] i386: expose floppy-related objects in SSDT Roman Kagan
2015-12-30 20:11 ` [Qemu-devel] [PATCH v5 1/6] i386/pc: expose identifying the floppy controller Roman Kagan
2015-12-30 20:11 ` Roman Kagan [this message]
2015-12-30 20:11 ` [Qemu-devel] [PATCH v5 3/6] tests/acpi: update test data Roman Kagan
2015-12-30 20:11 ` [Qemu-devel] [PATCH v5 4/6] expose floppy drive geometry and CMOS type Roman Kagan
2016-01-04 20:44 ` John Snow
2016-01-04 21:10 ` Michael S. Tsirkin
2016-01-06 13:55 ` [Qemu-devel] [Qemu-block] " Denis V. Lunev
2015-12-30 20:11 ` [Qemu-devel] [PATCH v5 5/6] i386: populate floppy drive information in SSDT Roman Kagan
2015-12-30 20:11 ` [Qemu-devel] [PATCH v5 6/6] tests/acpi: update test data Roman Kagan
2016-01-06 14:04 ` [Qemu-devel] [PATCH v5 0/6] i386: expose floppy-related objects in SSDT Igor Mammedov
2016-01-07 10:56 ` Michael S. Tsirkin
2016-01-07 10:56 ` Michael S. Tsirkin
2016-01-07 13:54 ` Igor Mammedov
2016-01-07 13:57 ` Igor Mammedov
2016-01-11 13:51 ` Igor Mammedov
2016-01-11 14:26 ` Roman Kagan
2016-01-11 14:47 ` Igor Mammedov
2016-01-11 15:05 ` Roman Kagan
2016-01-13 14:36 ` Laszlo Ersek
2016-01-13 15:49 ` Roman Kagan
2016-01-13 16:05 ` Roman Kagan
2016-01-13 16:23 ` Laszlo Ersek
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=1451506316-31975-3-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).