@@ -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");
@@ -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) {
@@ -80,7 +80,6 @@ DefinitionBlock (
, 3,
CBEN, 1, // COM2
}
- Name(FDEN, 1)
}
}
@@ -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
}
}
}
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 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 ++----- tests/acpi-test-data/pc/DSDT | Bin 3028 -> 2946 bytes tests/acpi-test-data/pc/SSDT | Bin 2486 -> 2554 bytes tests/acpi-test-data/pc/SSDT.bridge | Bin 4345 -> 4413 bytes tests/acpi-test-data/q35/DSDT | Bin 7666 -> 7578 bytes 8 files changed, 26 insertions(+), 24 deletions(-) diff --git a/tests/acpi-test-data/pc/DSDT b/tests/acpi-test-data/pc/DSDT index c658203db94a7e7db7c36fde99a7075a8d75498d..d8ebf12cc0abbbbe9f19d131c7b1d7d1b3e681df 100644 GIT binary patch delta 51 zcmca2-XzZD66_Mv#Ld9KxML%i4I`fet6qGtQ+$B4r$Ka+^W+dlCuRW$@yYWU7jEuh H^56sjVdo9@ delta 130 zcmZn?zaq}%66_Lkg`0tav1KEd4I`f$t6qGtQ+$B4r$Ka+=j0GZCr%DG7gs+<0Uznf zGZ`0pc(J&-I2&-pdw9C=I9_095Rr%v4sm2C04YjXz&1I7VF|-RmL**L9P!RU!Gh9U h67Gzjm_IQyu(&gRXa3I2z^LTFpvA(l*^J4D69A%9AeI0C diff --git a/tests/acpi-test-data/pc/SSDT b/tests/acpi-test-data/pc/SSDT index 210d6a71e58aa34ce8e94121d25bcf58c3bd503c..ffb3fe43970123d0e198328429ee04ebfd0564c9 100644 GIT binary patch delta 91 zcmdlc{7aZCIM^lR7bgP)<AjY|(Tq;cEHV1b@xe~<0nVNVp23ds(M<+!F3tuV@gANo vJdPLG893sdgMtO6xg^{fKQVt|W?*q={LcKHnSoKsfkBIfp>lIFV=xB*dq@{? delta 24 gcmew*yiJ%ZIM^j*8z%z;<MoYP(Ttl{G6r%00Az3ng8%>k diff --git a/tests/acpi-test-data/pc/SSDT.bridge b/tests/acpi-test-data/pc/SSDT.bridge index 6e6660b1fbe0bdb7fe0b257cb53c31fa9bb21a14..f0f11bec8108eceb696fb854b51faeb97471146c 100644 GIT binary patch delta 91 zcmeyVxL1iQIM^k`R*->#@y153XhtVzmKc5J_+Y2_0B27F&tS*+=q3X<7iR;Gcn?n( v9>)vp3>@*!LBWF3ToUe#pO`-}GqAWberNv9%)qGRz@Wv#P`NpoaT-4WWGfeO delta 24 gcmdn1^iz>5IM^lRrvL*3qryh6XvWPe8K>|A0A#NRg8%>k diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT index 4723e5954dccb00995ccaf521b7daf6bf15cf1d4..5e03e26323d50dea63d57a36bd902e061e0442d8 100644 GIT binary patch delta 91 zcmexlJ<FQQCD<iomMjAUqvA%cw~Txa?0WIRPVoWGo(9oP&XZZ0)EOlw>oQ5GMmP8b qIJ+`&HE}UTH;RJT49<?OevHmeK*A>gNC-HHPcCCxxH*}*UkU(Bo)>-q delta 176 zcmbPb{mGikCD<k8lPm)R<DrdQZyEV~*!ALro#F$WJq@Cp{3o+AsWU1})@70~WMFc0 zadu&fZtw|kc4gvf;$n(!lmf9CoE=^L7@eJfgiipFaB~3?0zT4{vzQioc(DL=8F0jV zc)IX7USMYsk%$itabzd}DN0ztHaUS|3By8`C0zU*@y<cPg3??P?u?(9KQS|~xHEod U{?5$6sN}$)#lo<eoq4hp0M<4v7ytkO