[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH v5 2/6] i386/acpi: make floppy controller object dy
From: |
Roman Kagan |
Subject: |
[Qemu-stable] [PATCH v5 2/6] i386/acpi: make floppy controller object dynamic |
Date: |
Wed, 30 Dec 2015 23:11:52 +0300 |
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 <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
---
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
- [Qemu-stable] [PATCH v5 0/6] i386: expose floppy-related objects in SSDT, Roman Kagan, 2015/12/30
- [Qemu-stable] [PATCH v5 1/6] i386/pc: expose identifying the floppy controller, Roman Kagan, 2015/12/30
- [Qemu-stable] [PATCH v5 3/6] tests/acpi: update test data, Roman Kagan, 2015/12/30
- [Qemu-stable] [PATCH v5 2/6] i386/acpi: make floppy controller object dynamic,
Roman Kagan <=
- [Qemu-stable] [PATCH v5 4/6] expose floppy drive geometry and CMOS type, Roman Kagan, 2015/12/30
- [Qemu-stable] [PATCH v5 5/6] i386: populate floppy drive information in SSDT, Roman Kagan, 2015/12/30
- [Qemu-stable] [PATCH v5 6/6] tests/acpi: update test data, Roman Kagan, 2015/12/30