From nobody Tue May 7 21:32:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585311374; cv=none; d=zohomail.com; s=zohoarc; b=A3IJBxKwPqDtBNMId61F7Ebwm0ixGd1AA5unoGfEEdz9TM2aCGVHldPA64mx5RDARwnv4wVNrxCkYD9++olpDkRYDWZUJ774EoOx9FOYQF353Qe/ffZSRuuN7ro/Z04j14jx9Bo2/NOgmQfX9bthPr+OT6ZH3l76/sGbl5t2ezw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585311374; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=gzkel0+n+eEm5qu560ABS1vOYNgluJp9ebLNb1bJYSc=; b=g40T4/KHl+ZfCgJtMLMV9Dsdsir8YypaiRgPhU2dlvI2kBBjQbJzok2WOHhmdI8XEHDRm4aeGy95/73EI++4wIOHWfA1hC93hcUJwxn41cIQw6ITaVam0mL1bmcKiVFFTAeiaA4zAkeb1OuYXdfcNJsZzESUc+Mf3QmoZKmQFpY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585311374660169.20072545434664; Fri, 27 Mar 2020 05:16:14 -0700 (PDT) Received: from localhost ([::1]:41074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnuH-0002pf-8e for importer@patchew.org; Fri, 27 Mar 2020 08:16:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35346) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnpg-0005PL-43 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHnpd-0002Of-En for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:27 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:32087) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHnpd-0002Mp-AJ for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-yxLGG3jZMwOyCjBpbJuNeg-1; Fri, 27 Mar 2020 08:11:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51BA5100550E; Fri, 27 Mar 2020 12:11:20 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id C958EA0A88; Fri, 27 Mar 2020 12:11:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C89B69CA5; Fri, 27 Mar 2020 13:11:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585311085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gzkel0+n+eEm5qu560ABS1vOYNgluJp9ebLNb1bJYSc=; b=HlpK7HfEN7p0C4asgmGGpF2ptofBNkRrKIdTHXc0HXdqoukul6l7oDeG+IruEKevO4Zer+ gnMLnxNTJezcOWCNwN2NBiS1/1ftjVA0ofTzELL+OuNKT5cb/1iX45VukOwT36prT9YL4B p2IOpOCU97wQO7qK9UEyppCJyM/r5JM= X-MC-Unique: yxLGG3jZMwOyCjBpbJuNeg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 1/6] acpi: split hw/i386/acpi-build.c Date: Fri, 27 Mar 2020 13:11:06 +0100 Message-Id: <20200327121111.1530-2-kraxel@redhat.com> In-Reply-To: <20200327121111.1530-1-kraxel@redhat.com> References: <20200327121111.1530-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Split hw/i386/acpi-build.c into pieces: acpi-build-internal.h Internal header file for acpi-buid-*.c acpi-build-core.c The acpi_setup() function + dependencies. The acpi_build() function simply calls acpi_build_pc() for now, at some point in the future this will dispatch into machine-type specific build functions. acpi-build-pc.c The acpi_build_pc() function + dependencies. The bulk of the old acpi-build.c file is here now. Signed-off-by: Gerd Hoffmann --- hw/i386/acpi-build-internal.h | 35 ++++ hw/i386/acpi-build-core.c | 191 ++++++++++++++++++++++ hw/i386/{acpi-build.c =3D> acpi-build-pc.c} | 175 +------------------- hw/i386/Makefile.objs | 3 +- 4 files changed, 230 insertions(+), 174 deletions(-) create mode 100644 hw/i386/acpi-build-internal.h create mode 100644 hw/i386/acpi-build-core.c rename hw/i386/{acpi-build.c =3D> acpi-build-pc.c} (94%) diff --git a/hw/i386/acpi-build-internal.h b/hw/i386/acpi-build-internal.h new file mode 100644 index 000000000000..5e783d85dde6 --- /dev/null +++ b/hw/i386/acpi-build-internal.h @@ -0,0 +1,35 @@ + +#ifndef HW_I386_ACPI_BUILD_INTERNAL_H +#define HW_I386_ACPI_BUILD_INTERNAL_H + +#include "hw/acpi/aml-build.h" + +/* #define DEBUG_ACPI_BUILD */ +#ifdef DEBUG_ACPI_BUILD +#define ACPI_BUILD_DPRINTF(fmt, ...) \ + do {printf("ACPI_BUILD: " fmt, ## __VA_ARGS__); } while (0) +#else +#define ACPI_BUILD_DPRINTF(fmt, ...) +#endif + +typedef +struct AcpiBuildState { + /* Copy of table in RAM (for patching). */ + MemoryRegion *table_mr; + /* Is table patched? */ + uint8_t patched; + void *rsdp; + MemoryRegion *rsdp_mr; + MemoryRegion *linker_mr; +} AcpiBuildState; + +typedef struct FwCfgTPMConfig { + uint32_t tpmppi_address; + uint8_t tpm_version; + uint8_t tpmppi_version; +} QEMU_PACKED FwCfgTPMConfig; + +/* acpi-build-pc.c */ +void acpi_build_pc(AcpiBuildTables *tables, MachineState *machine); + +#endif diff --git a/hw/i386/acpi-build-core.c b/hw/i386/acpi-build-core.c new file mode 100644 index 000000000000..f0968b4bb594 --- /dev/null +++ b/hw/i386/acpi-build-core.c @@ -0,0 +1,191 @@ +/* Support for generating ACPI tables and passing them to Guests + * + * Copyright (C) 2008-2010 Kevin O'Connor + * Copyright (C) 2006 Fabrice Bellard + * Copyright (C) 2013 Red Hat Inc + * + * Author: Michael S. Tsirkin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" + +#include "exec/memory.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/aml-build.h" +#include "hw/acpi/bios-linker-loader.h" +#include "hw/acpi/tpm.h" +#include "hw/acpi/utils.h" +#include "hw/acpi/vmgenid.h" +#include "hw/boards.h" +#include "hw/i386/pc.h" +#include "migration/vmstate.h" +#include "sysemu/reset.h" +#include "sysemu/tpm.h" + +#include "acpi-build.h" +#include "acpi-build-internal.h" + +static void acpi_build(AcpiBuildTables *tables, MachineState *machine) +{ + acpi_build_pc(tables, machine); +} + +static void acpi_ram_update(MemoryRegion *mr, GArray *data) +{ + uint32_t size =3D acpi_data_len(data); + + /* Make sure RAM size is correct - in case it got changed e.g. by migr= ation */ + memory_region_ram_resize(mr, size, &error_abort); + + memcpy(memory_region_get_ram_ptr(mr), data->data, size); + memory_region_set_dirty(mr, 0, size); +} + +static void acpi_build_update(void *build_opaque) +{ + AcpiBuildState *build_state =3D build_opaque; + AcpiBuildTables tables; + + /* No state to update or already patched? Nothing to do. */ + if (!build_state || build_state->patched) { + return; + } + build_state->patched =3D 1; + + acpi_build_tables_init(&tables); + + acpi_build(&tables, MACHINE(qdev_get_machine())); + + acpi_ram_update(build_state->table_mr, tables.table_data); + + if (build_state->rsdp) { + memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.= rsdp)); + } else { + acpi_ram_update(build_state->rsdp_mr, tables.rsdp); + } + + acpi_ram_update(build_state->linker_mr, tables.linker->cmd_blob); + acpi_build_tables_cleanup(&tables, true); +} + +static void acpi_build_reset(void *build_opaque) +{ + AcpiBuildState *build_state =3D build_opaque; + build_state->patched =3D 0; +} + +static const VMStateDescription vmstate_acpi_build =3D { + .name =3D "acpi_build", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(patched, AcpiBuildState), + VMSTATE_END_OF_LIST() + }, +}; + +void acpi_setup(void) +{ + PCMachineState *pcms =3D PC_MACHINE(qdev_get_machine()); + PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); + X86MachineState *x86ms =3D X86_MACHINE(pcms); + AcpiBuildTables tables; + AcpiBuildState *build_state; + Object *vmgenid_dev; + TPMIf *tpm; + static FwCfgTPMConfig tpm_config; + + if (!x86ms->fw_cfg) { + ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n"); + return; + } + + if (!pcms->acpi_build_enabled) { + ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); + return; + } + + if (!acpi_enabled) { + ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); + return; + } + + build_state =3D g_malloc0(sizeof *build_state); + + acpi_build_tables_init(&tables); + acpi_build(&tables, MACHINE(pcms)); + + /* Now expose it all to Guest */ + build_state->table_mr =3D acpi_add_rom_blob(acpi_build_update, + build_state, tables.table_da= ta, + ACPI_BUILD_TABLE_FILE, + ACPI_BUILD_TABLE_MAX_SIZE); + assert(build_state->table_mr !=3D NULL); + + build_state->linker_mr =3D + acpi_add_rom_blob(acpi_build_update, build_state, + tables.linker->cmd_blob, "etc/table-loader", 0); + + fw_cfg_add_file(x86ms->fw_cfg, ACPI_BUILD_TPMLOG_FILE, + tables.tcpalog->data, acpi_data_len(tables.tcpalog)); + + tpm =3D tpm_find(); + if (tpm && object_property_get_bool(OBJECT(tpm), "ppi", &error_abort))= { + tpm_config =3D (FwCfgTPMConfig) { + .tpmppi_address =3D cpu_to_le32(TPM_PPI_ADDR_BASE), + .tpm_version =3D tpm_get_version(tpm), + .tpmppi_version =3D TPM_PPI_VERSION_1_30 + }; + fw_cfg_add_file(x86ms->fw_cfg, "etc/tpm/config", + &tpm_config, sizeof tpm_config); + } + + vmgenid_dev =3D find_vmgenid_dev(); + if (vmgenid_dev) { + vmgenid_add_fw_cfg(VMGENID(vmgenid_dev), x86ms->fw_cfg, + tables.vmgenid); + } + + if (!pcmc->rsdp_in_ram) { + /* + * Keep for compatibility with old machine types. + * Though RSDP is small, its contents isn't immutable, so + * we'll update it along with the rest of tables on guest access. + */ + uint32_t rsdp_size =3D acpi_data_len(tables.rsdp); + + build_state->rsdp =3D g_memdup(tables.rsdp->data, rsdp_size); + fw_cfg_add_file_callback(x86ms->fw_cfg, ACPI_BUILD_RSDP_FILE, + acpi_build_update, NULL, build_state, + build_state->rsdp, rsdp_size, true); + build_state->rsdp_mr =3D NULL; + } else { + build_state->rsdp =3D NULL; + build_state->rsdp_mr =3D acpi_add_rom_blob(acpi_build_update, + build_state, tables.rsdp, + ACPI_BUILD_RSDP_FILE, 0); + } + + qemu_register_reset(acpi_build_reset, build_state); + acpi_build_reset(build_state); + vmstate_register(NULL, 0, &vmstate_acpi_build, build_state); + + /* Cleanup tables but don't free the memory: we track it + * in build_state. + */ + acpi_build_tables_cleanup(&tables, false); +} diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build-pc.c similarity index 94% rename from hw/i386/acpi-build.c rename to hw/i386/acpi-build-pc.c index 9a19c14e661b..cad44160ff3a 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build-pc.c @@ -24,6 +24,7 @@ #include "qapi/error.h" #include "qapi/qmp/qnum.h" #include "acpi-build.h" +#include "acpi-build-internal.h" #include "qemu/bitmap.h" #include "qemu/error-report.h" #include "hw/pci/pci.h" @@ -81,14 +82,6 @@ =20 #define ACPI_BUILD_TABLE_SIZE 0x20000 =20 -/* #define DEBUG_ACPI_BUILD */ -#ifdef DEBUG_ACPI_BUILD -#define ACPI_BUILD_DPRINTF(fmt, ...) \ - do {printf("ACPI_BUILD: " fmt, ## __VA_ARGS__); } while (0) -#else -#define ACPI_BUILD_DPRINTF(fmt, ...) -#endif - /* Default IOAPIC ID */ #define ACPI_BUILD_IOAPIC_ID 0x0 =20 @@ -120,12 +113,6 @@ typedef struct AcpiBuildPciBusHotplugState { bool pcihp_bridge_en; } AcpiBuildPciBusHotplugState; =20 -typedef struct FwCfgTPMConfig { - uint32_t tpmppi_address; - uint8_t tpm_version; - uint8_t tpmppi_version; -} QEMU_PACKED FwCfgTPMConfig; - static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg); =20 static void init_common_fadt_data(MachineState *ms, Object *o, @@ -2710,17 +2697,6 @@ build_amd_iommu(GArray *table_data, BIOSLinker *link= er) "IVRS", table_data->len - iommu_start, 1, NULL, NULL); } =20 -typedef -struct AcpiBuildState { - /* Copy of table in RAM (for patching). */ - MemoryRegion *table_mr; - /* Is table patched? */ - uint8_t patched; - void *rsdp; - MemoryRegion *rsdp_mr; - MemoryRegion *linker_mr; -} AcpiBuildState; - static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) { Object *pci_host; @@ -2746,8 +2722,7 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) return true; } =20 -static -void acpi_build(AcpiBuildTables *tables, MachineState *machine) +void acpi_build_pc(AcpiBuildTables *tables, MachineState *machine) { PCMachineState *pcms =3D PC_MACHINE(machine); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); @@ -2948,149 +2923,3 @@ void acpi_build(AcpiBuildTables *tables, MachineSta= te *machine) /* Cleanup memory that's no longer used. */ g_array_free(table_offsets, true); } - -static void acpi_ram_update(MemoryRegion *mr, GArray *data) -{ - uint32_t size =3D acpi_data_len(data); - - /* Make sure RAM size is correct - in case it got changed e.g. by migr= ation */ - memory_region_ram_resize(mr, size, &error_abort); - - memcpy(memory_region_get_ram_ptr(mr), data->data, size); - memory_region_set_dirty(mr, 0, size); -} - -static void acpi_build_update(void *build_opaque) -{ - AcpiBuildState *build_state =3D build_opaque; - AcpiBuildTables tables; - - /* No state to update or already patched? Nothing to do. */ - if (!build_state || build_state->patched) { - return; - } - build_state->patched =3D 1; - - acpi_build_tables_init(&tables); - - acpi_build(&tables, MACHINE(qdev_get_machine())); - - acpi_ram_update(build_state->table_mr, tables.table_data); - - if (build_state->rsdp) { - memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.= rsdp)); - } else { - acpi_ram_update(build_state->rsdp_mr, tables.rsdp); - } - - acpi_ram_update(build_state->linker_mr, tables.linker->cmd_blob); - acpi_build_tables_cleanup(&tables, true); -} - -static void acpi_build_reset(void *build_opaque) -{ - AcpiBuildState *build_state =3D build_opaque; - build_state->patched =3D 0; -} - -static const VMStateDescription vmstate_acpi_build =3D { - .name =3D "acpi_build", - .version_id =3D 1, - .minimum_version_id =3D 1, - .fields =3D (VMStateField[]) { - VMSTATE_UINT8(patched, AcpiBuildState), - VMSTATE_END_OF_LIST() - }, -}; - -void acpi_setup(void) -{ - PCMachineState *pcms =3D PC_MACHINE(qdev_get_machine()); - PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); - X86MachineState *x86ms =3D X86_MACHINE(pcms); - AcpiBuildTables tables; - AcpiBuildState *build_state; - Object *vmgenid_dev; - TPMIf *tpm; - static FwCfgTPMConfig tpm_config; - - if (!x86ms->fw_cfg) { - ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n"); - return; - } - - if (!pcms->acpi_build_enabled) { - ACPI_BUILD_DPRINTF("ACPI build disabled. Bailing out.\n"); - return; - } - - if (!acpi_enabled) { - ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); - return; - } - - build_state =3D g_malloc0(sizeof *build_state); - - acpi_build_tables_init(&tables); - acpi_build(&tables, MACHINE(pcms)); - - /* Now expose it all to Guest */ - build_state->table_mr =3D acpi_add_rom_blob(acpi_build_update, - build_state, tables.table_da= ta, - ACPI_BUILD_TABLE_FILE, - ACPI_BUILD_TABLE_MAX_SIZE); - assert(build_state->table_mr !=3D NULL); - - build_state->linker_mr =3D - acpi_add_rom_blob(acpi_build_update, build_state, - tables.linker->cmd_blob, "etc/table-loader", 0); - - fw_cfg_add_file(x86ms->fw_cfg, ACPI_BUILD_TPMLOG_FILE, - tables.tcpalog->data, acpi_data_len(tables.tcpalog)); - - tpm =3D tpm_find(); - if (tpm && object_property_get_bool(OBJECT(tpm), "ppi", &error_abort))= { - tpm_config =3D (FwCfgTPMConfig) { - .tpmppi_address =3D cpu_to_le32(TPM_PPI_ADDR_BASE), - .tpm_version =3D tpm_get_version(tpm), - .tpmppi_version =3D TPM_PPI_VERSION_1_30 - }; - fw_cfg_add_file(x86ms->fw_cfg, "etc/tpm/config", - &tpm_config, sizeof tpm_config); - } - - vmgenid_dev =3D find_vmgenid_dev(); - if (vmgenid_dev) { - vmgenid_add_fw_cfg(VMGENID(vmgenid_dev), x86ms->fw_cfg, - tables.vmgenid); - } - - if (!pcmc->rsdp_in_ram) { - /* - * Keep for compatibility with old machine types. - * Though RSDP is small, its contents isn't immutable, so - * we'll update it along with the rest of tables on guest access. - */ - uint32_t rsdp_size =3D acpi_data_len(tables.rsdp); - - build_state->rsdp =3D g_memdup(tables.rsdp->data, rsdp_size); - fw_cfg_add_file_callback(x86ms->fw_cfg, ACPI_BUILD_RSDP_FILE, - acpi_build_update, NULL, build_state, - build_state->rsdp, rsdp_size, true); - build_state->rsdp_mr =3D NULL; - } else { - build_state->rsdp =3D NULL; - build_state->rsdp_mr =3D acpi_add_rom_blob(acpi_build_update, - build_state, tables.rsdp, - ACPI_BUILD_RSDP_FILE, 0); - } - - qemu_register_reset(acpi_build_reset, build_state); - acpi_build_reset(build_state); - vmstate_register(NULL, 0, &vmstate_acpi_build, build_state); - - /* Cleanup tables but don't free the memory: we track it - * in build_state. - */ - acpi_build_tables_cleanup(&tables, false); -} diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 8ce1b265335b..e777f1ac9fc3 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -16,4 +16,5 @@ obj-$(CONFIG_VMMOUSE) +=3D vmmouse.o obj-$(CONFIG_PC) +=3D port92.o =20 obj-y +=3D kvmvapic.o -obj-$(CONFIG_PC) +=3D acpi-build.o +obj-$(CONFIG_PC) +=3D acpi-build-core.o +obj-$(CONFIG_PC) +=3D acpi-build-pc.o --=20 2.18.2 From nobody Tue May 7 21:32:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585311240; cv=none; d=zohomail.com; s=zohoarc; b=cfhlXxElkjP52ud00h8osPyHU/bu3OW+arZTaOjb/cviedDySaU9FBEVuiIsQ3DcGluhFzeWWyHRKisS20oMl7mZmtkppWyMpwUMR3rzocAmH4KLBMB4p3uwNmQ+sjQ371jvrkCCN4lBKEWYXP4bK/VXantKHmkiCF8DWp70HeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585311240; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P4LbFLFNfhoCRPregA0NOj+Xtp8e0pU8PyiFRkAwvEY=; b=Gx6o7y+CcSe9kKHQPcPxR9YHNlNIXCFPOZIOe4b4NC2KueudAteeZgz02V/GT4kLZXpRXG34cJAalGSUm2YgUBGz4lRpZKv/hbLE2t3iB5HSZf/CSNdD8E3FlUqkAMSWS4KAiqp4W6rLAVUFd0wvW1mb/HdQBH1fa7s+RgzFPCc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585311240302982.1929459204957; Fri, 27 Mar 2020 05:14:00 -0700 (PDT) Received: from localhost ([::1]:41048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHns7-00014L-Nh for importer@patchew.org; Fri, 27 Mar 2020 08:13:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35290) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnpc-0005He-Rm for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHnpb-0002Ex-LP for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:24 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:37769) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHnpb-0002EZ-HK for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:23 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-sQoixQBsPq2OD09VpBi-MQ-1; Fri, 27 Mar 2020 08:11:19 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C3967DBA6; Fri, 27 Mar 2020 12:11:18 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC7705DA75; Fri, 27 Mar 2020 12:11:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D17232049E; Fri, 27 Mar 2020 13:11:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585311083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P4LbFLFNfhoCRPregA0NOj+Xtp8e0pU8PyiFRkAwvEY=; b=Xh9KyqT+tFrgjz+VSMKelNqG365pLctsGivCPSSHjS460O5Sjuo7upghYLbNUWoZADPE1S U845DeM63484qFt0PwuN74Z1CPIf+gFaY01cZWb6Uc84AZdJ76Cx+AruqfEWkCujES7D5X g/s5a86uNkLSGPTFEGsJNfnF7JEntRA= X-MC-Unique: sQoixQBsPq2OD09VpBi-MQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 2/6] acpi: make build_madt() more generic. Date: Fri, 27 Mar 2020 13:11:07 +0100 Message-Id: <20200327121111.1530-3-kraxel@redhat.com> In-Reply-To: <20200327121111.1530-1-kraxel@redhat.com> References: <20200327121111.1530-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Remove PCMachineState dependency from build_madt(). Pass AcpiDeviceIf as separate argument instead of depending on PCMachineState->acpi_dev. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/acpi-build-pc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/i386/acpi-build-pc.c b/hw/i386/acpi-build-pc.c index cad44160ff3a..a9dbf080566b 100644 --- a/hw/i386/acpi-build-pc.c +++ b/hw/i386/acpi-build-pc.c @@ -347,14 +347,13 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, } =20 static void -build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms) +build_madt(GArray *table_data, BIOSLinker *linker, + X86MachineState *x86ms, AcpiDeviceIf *adev) { - MachineClass *mc =3D MACHINE_GET_CLASS(pcms); - X86MachineState *x86ms =3D X86_MACHINE(pcms); - const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(pc= ms)); + MachineClass *mc =3D MACHINE_GET_CLASS(x86ms); + const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(x8= 6ms)); int madt_start =3D table_data->len; - AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(pcms->acpi_dev); - AcpiDeviceIf *adev =3D ACPI_DEVICE_IF(pcms->acpi_dev); + AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(adev); bool x2apic_mode =3D false; =20 AcpiMultipleApicTable *madt; @@ -2782,7 +2781,8 @@ void acpi_build_pc(AcpiBuildTables *tables, MachineSt= ate *machine) aml_len +=3D tables_blob->len - fadt; =20 acpi_add_table(table_offsets, tables_blob); - build_madt(tables_blob, tables->linker, pcms); + build_madt(tables_blob, tables->linker, x86ms, + ACPI_DEVICE_IF(pcms->acpi_dev)); =20 vmgenid_dev =3D find_vmgenid_dev(); if (vmgenid_dev) { --=20 2.18.2 From nobody Tue May 7 21:32:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585311154; cv=none; d=zohomail.com; s=zohoarc; b=dj+jFoqE0NC8p11mkQaaxq+gzYn5THmspsOHAl+Bb5VpOn8yK0aDYWUIsB2XpFmvoMmbEf0Kcvsm3QbvhrhJSJinBrN6Mf01rMnX82pQauhqCb/zMVACEeig7CbuGa6PN3QrPSwOd2dW7lA6H+gNA3OJ9IBz9I6C/cLHN4Tqyd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585311154; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Hea1bht1fKA6dt6ayRV0qg1GVJrLQ2Ix4Rni9cAUNxE=; b=PErgPkICODHona5ARh8+0sJ5bvKwwZ4wb7m6lnjMC7kqjIgfSjmAAjdkhLxon2+pX6psQHOwDzJ3XzjduvMMZATd1ln+qRzlhdYv0Onex9WfTOLyFNtDd5k/orxhbrFhfSJFgfYxCB7DFvKQl+Eq4zQ8VPC69GdYamnk/mMPtKk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585311154822661.0775570940224; Fri, 27 Mar 2020 05:12:34 -0700 (PDT) Received: from localhost ([::1]:41024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnqj-0006qz-M9 for importer@patchew.org; Fri, 27 Mar 2020 08:12:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35224) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnpb-0005HL-6c for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHnpZ-0002AR-Kb for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:22 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:56604) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHnpZ-00028k-H9 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:21 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-371-k1h3eo1vMXeXSp-U3SzBsQ-1; Fri, 27 Mar 2020 08:11:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8CF5B18C8C01; Fri, 27 Mar 2020 12:11:18 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id B25215C1D4; Fri, 27 Mar 2020 12:11:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DA359204A1; Fri, 27 Mar 2020 13:11:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585311081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hea1bht1fKA6dt6ayRV0qg1GVJrLQ2Ix4Rni9cAUNxE=; b=HSLAQBCoKjCU2T5HfIg2wWTW1wi6LzMbirGaGAEzAeXbQLlyOUiDtvyqp2Hw607dKkE0TR 49Cx2f9ZcGwxJsoDBuD/A2ZdQsD6pJLEjSlxjXbkxiKjDwYFCDu5qZGPhTUi9E3KaU/mkN 8kIDcCMUtTdZTA15g50Yil0OI2odlNU= X-MC-Unique: k1h3eo1vMXeXSp-U3SzBsQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 3/6] acpi: factor out acpi_dsdt_add_fw_cfg() Date: Fri, 27 Mar 2020 13:11:08 +0100 Message-Id: <20200327121111.1530-4-kraxel@redhat.com> In-Reply-To: <20200327121111.1530-1-kraxel@redhat.com> References: <20200327121111.1530-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add helper function to add fw_cfg device. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Igor Mammedov --- hw/i386/acpi-build-pc.c | 51 ++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/hw/i386/acpi-build-pc.c b/hw/i386/acpi-build-pc.c index a9dbf080566b..3fdae2984b91 100644 --- a/hw/i386/acpi-build-pc.c +++ b/hw/i386/acpi-build-pc.c @@ -1809,6 +1809,33 @@ static void build_smb0(Aml *table, I2CBus *smbus, in= t devnr, int func) aml_append(table, scope); } =20 +static void acpi_dsdt_add_fw_cfg(Aml *scope, FWCfgState *fw_cfg) +{ + /* + * when using port i/o, the 8-bit data register *always* overlaps + * with half of the 16-bit control register. Hence, the total size + * of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the + * DMA control register is located at FW_CFG_DMA_IO_BASE + 4 + */ + Object *obj =3D OBJECT(fw_cfg); + uint8_t io_size =3D object_property_get_bool(obj, "dma_enabled", NULL)= ? + ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t) : + FW_CFG_CTL_SIZE; + Aml *dev =3D aml_device("FWCF"); + Aml *crs =3D aml_resource_template(); + + aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002"))); + + /* device present, functioning, decoding, not shown in UI */ + aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); + + aml_append(crs, + aml_io(AML_DECODE16, FW_CFG_IO_BASE, FW_CFG_IO_BASE, 0x01, io_size= )); + + aml_append(dev, aml_name_decl("_CRS", crs)); + aml_append(scope, dev); +} + static void build_dsdt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -2088,30 +2115,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, =20 /* create fw_cfg node, unconditionally */ { - /* when using port i/o, the 8-bit data register *always* overlaps - * with half of the 16-bit control register. Hence, the total size - * of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the - * DMA control register is located at FW_CFG_DMA_IO_BASE + 4 */ - uint8_t io_size =3D object_property_get_bool(OBJECT(x86ms->fw_cfg), - "dma_enabled", NULL) ? - ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t= ) : - FW_CFG_CTL_SIZE; - scope =3D aml_scope("\\_SB.PCI0"); - dev =3D aml_device("FWCF"); - - aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002"))); - - /* device present, functioning, decoding, not shown in UI */ - aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); - - crs =3D aml_resource_template(); - aml_append(crs, - aml_io(AML_DECODE16, FW_CFG_IO_BASE, FW_CFG_IO_BASE, 0x01, io_= size) - ); - aml_append(dev, aml_name_decl("_CRS", crs)); - - aml_append(scope, dev); + acpi_dsdt_add_fw_cfg(scope, x86ms->fw_cfg); aml_append(dsdt, scope); } =20 --=20 2.18.2 From nobody Tue May 7 21:32:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585311154; cv=none; d=zohomail.com; s=zohoarc; b=K6EQi+dyA7nGVvC4l8MAizEZFbCVl6MNoWN1tZ1csHoUr9xSnadE2ZqMjNOSCyMW9e2AODZ/fAHjxqI9zdbrFiIHMK2W82rP8AHtirl8qIiBE1hsAYadrBa3KB4NjYu26N52lb27NAfEkcCPV4NysBFobTVrBXevYEEqAT8xuB8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585311154; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=zKFU+QLhKKKhlgw/DTPXPv/7+TQNF+2jYPAaGnR8B5o=; b=XZawfxkJ3jg3F7AqXX2lIQi+4S7B2BnrhAYg8sAw1Fc5ARrK7v8u/CD6TxJTeeRx70TzsmYJOY35RYJDTIiOZe35uFk1NyoWwyuLlMuSL1bw6ixTpKkSet9B1kBzacfl0lTo9ur8Wf5wrSgzu12Fkjqi7h8IbzgXeCRA45tGAF0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585311154496173.27772590383643; Fri, 27 Mar 2020 05:12:34 -0700 (PDT) Received: from localhost ([::1]:41022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnqi-0006ot-EM for importer@patchew.org; Fri, 27 Mar 2020 08:12:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35229) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnpb-0005HN-6Z for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHnpZ-0002AY-MM for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:22 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:24066) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHnpZ-00029B-Ie for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:21 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-ToRXe8pgON2fyaw7FGUjDQ-1; Fri, 27 Mar 2020 08:11:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1AFD9100550E; Fri, 27 Mar 2020 12:11:18 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id D01707E311; Fri, 27 Mar 2020 12:11:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E2EFB31E3F; Fri, 27 Mar 2020 13:11:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585311081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zKFU+QLhKKKhlgw/DTPXPv/7+TQNF+2jYPAaGnR8B5o=; b=HPSbAx+OEJMm9+aT1Yh7zITT0b3QVfryWnJjO66O8KOZ7IeXlByYuYWEuJFsiPX4oMUuiR cNLmhnmrr+JkzF/ZHx3M743LPc2UU4ndQg0xVbnHbcUm++AFurIy4LMrPiriaBPj3s3bns 9+30uFoCqC33gYj41rFgP31EppTV8h8= X-MC-Unique: ToRXe8pgON2fyaw7FGUjDQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 4/6] acpi: drop pointless _STA method Date: Fri, 27 Mar 2020 13:11:09 +0100 Message-Id: <20200327121111.1530-5-kraxel@redhat.com> In-Reply-To: <20200327121111.1530-1-kraxel@redhat.com> References: <20200327121111.1530-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When returning a constant there is no point in having a method in the first place, _STA can be a simple integer instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov --- hw/i386/acpi-build-pc.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/hw/i386/acpi-build-pc.c b/hw/i386/acpi-build-pc.c index 3fdae2984b91..18ca2fd46961 100644 --- a/hw/i386/acpi-build-pc.c +++ b/hw/i386/acpi-build-pc.c @@ -1137,14 +1137,11 @@ static Aml *build_kbd_device_aml(void) { Aml *dev; Aml *crs; - Aml *method; =20 dev =3D aml_device("KBD"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0303"))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_int(0x0f))); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01)); @@ -1159,14 +1156,11 @@ static Aml *build_mouse_device_aml(void) { Aml *dev; Aml *crs; - Aml *method; =20 dev =3D aml_device("MOU"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0F13"))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_int(0x0f))); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_irq_no_flags(12)); @@ -2229,9 +2223,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, TPM_CRB_ADDR_SIZE, AML_READ_WRI= TE)); aml_append(dev, aml_name_decl("_CRS", crs)); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_int(0x0f))); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 tpm_build_ppi_acpi(tpm, dev); =20 --=20 2.18.2 From nobody Tue May 7 21:32:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585311156; cv=none; d=zohomail.com; s=zohoarc; b=f5QdxSqsVmvYGGA7xV21Z0aZuD+/3bMRh4ofLa5q7mUb8U9OiEZVLYxyEWW8TtY9T7m8ysaOZxaLxPq9mIP/9kx/EHY9ukGWIcnRkU2snGlsDijyr2vEpkvAfUj1QJ4K1G5JcfD6fz8+4C8XUF6oAiEjomPz25iZ39gxCrGUmhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585311156; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=iecBE+0B1PGZoq65FTFsNM1AMbDLLSz4/8wfLx6LjOs=; b=F/KU3RKXx+fZqF9thXu34uP6+jfb8MrFwi4jeabHabZEz8JdsoUEFS5KApNMBGOo0DLIEbt0uHesAG5VNUNwZ+tAeq/jfd/So0EaME40Y6Dgtv8+ueKZjBbpv9gWme7Pt0SHrEAV1y6OUu1UeuoYh0xb6KYj2Ui02sUAnVIH8mk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585311156827275.5840660808366; Fri, 27 Mar 2020 05:12:36 -0700 (PDT) Received: from localhost ([::1]:41026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnql-0006vJ-RJ for importer@patchew.org; Fri, 27 Mar 2020 08:12:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35286) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnpc-0005Hd-NV for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHnpb-0002Ej-Dc for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:24 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:56540) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHnpb-0002Cl-AE for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:23 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-80-qIOTUP2fPRqVXEHceBeNQw-1; Fri, 27 Mar 2020 08:11:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC3C1DBAB; Fri, 27 Mar 2020 12:11:19 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 492395E01D; Fri, 27 Mar 2020 12:11:19 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EBA5B31E47; Fri, 27 Mar 2020 13:11:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585311082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iecBE+0B1PGZoq65FTFsNM1AMbDLLSz4/8wfLx6LjOs=; b=Z0bwGD+M4DOsbX8kQgRrTjg06qiB/kdmuy89gwoSQtkm1uzu2xh8NVixJZxGgy9hXwOEyO oGuc1ljo4I4MHToXtfYvnvN5IrwpHZw6eG4pwxHRKKIrUJgmWOgBTEqEejRBYqXtTgZj3r ZK+rVVO+Jf2zXS34+ff6xsR7h2MC8c4= X-MC-Unique: qIOTUP2fPRqVXEHceBeNQw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 5/6] acpi: serial: don't use _STA method Date: Fri, 27 Mar 2020 13:11:10 +0100 Message-Id: <20200327121111.1530-6-kraxel@redhat.com> In-Reply-To: <20200327121111.1530-1-kraxel@redhat.com> References: <20200327121111.1530-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The _STA method dates back to the days where we had a static DSDT. The device is listed in the DSDT table unconditionally and the _STA method checks a bit in the isa bridge pci config space to figure whenever a given is isa device is present or not, then evaluates to 0x0f (present) or 0x00 (absent). These days the DSDT is generated by qemu anyway, so if a device is not present we can simply drop it from the DSDT instead. Signed-off-by: Gerd Hoffmann --- hw/i386/acpi-build-pc.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/hw/i386/acpi-build-pc.c b/hw/i386/acpi-build-pc.c index 18ca2fd46961..97af5eac3d79 100644 --- a/hw/i386/acpi-build-pc.c +++ b/hw/i386/acpi-build-pc.c @@ -1204,50 +1204,34 @@ static Aml *build_lpt_device_aml(void) return dev; } =20 -static Aml *build_com_device_aml(uint8_t uid) +static void build_com_device_aml(Aml *scope, uint8_t uid) { Aml *dev; Aml *crs; - Aml *method; - Aml *if_ctx; - Aml *else_ctx; - Aml *zero =3D aml_int(0); - Aml *is_present =3D aml_local(0); - const char *enabled_field =3D "CAEN"; uint8_t irq =3D 4; uint16_t io_port =3D 0x03F8; =20 assert(uid =3D=3D 1 || uid =3D=3D 2); if (uid =3D=3D 2) { - enabled_field =3D "CBEN"; irq =3D 3; io_port =3D 0x02F8; } + if (!memory_region_present(get_system_io(), io_port)) { + return; + } =20 dev =3D aml_device("COM%d", uid); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501"))); aml_append(dev, aml_name_decl("_UID", aml_int(uid))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_store(aml_name("%s", enabled_field), is_present= )); - if_ctx =3D aml_if(aml_equal(is_present, zero)); - { - aml_append(if_ctx, aml_return(aml_int(0x00))); - } - aml_append(method, if_ctx); - else_ctx =3D aml_else(); - { - aml_append(else_ctx, aml_return(aml_int(0x0f))); - } - aml_append(method, else_ctx); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, io_port, io_port, 0x00, 0x08)); aml_append(crs, aml_irq_no_flags(irq)); aml_append(dev, aml_name_decl("_CRS", crs)); =20 - return dev; + aml_append(scope, dev); } =20 static void build_isa_devices_aml(Aml *table) @@ -1265,8 +1249,8 @@ static void build_isa_devices_aml(Aml *table) aml_append(scope, build_fdc_device_aml(fdc)); } aml_append(scope, build_lpt_device_aml()); - aml_append(scope, build_com_device_aml(1)); - aml_append(scope, build_com_device_aml(2)); + build_com_device_aml(scope, 1); + build_com_device_aml(scope, 2); =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); --=20 2.18.2 From nobody Tue May 7 21:32:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585311292; cv=none; d=zohomail.com; s=zohoarc; b=TD7LZmnMT3ryAn9awltQbo9D9VQe7UTxmWJi/7b0IqauOOQxRh04KZZbINFmiE6dlIvwBLb1KgjmNkkszVcustI9ZpOlgzpt2KMoRQjTB86+3N2V+1qsT+vh8bccI8721wrlyB87ZRz/ZIvCvwf3CbujFBDeSEtawNM0Gw2O9wI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585311292; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=PgO6+1B/924aEFh7adFRZ27OOSLbW6GRY9QNhris/8k=; b=Act0y5sXpcSHjf8hccVHud9Rx8OeQn2k9VGz9lYfNjNv94VWgW3X/SJynGEX6nKlsI2pJu/IvtbrUs9wysVRPob78gwnqhdt8bcOrWx2VdDvtC6/aTy7yQDgJ4uKgqkI42dWz8QrmvvrLLYRGVsfkyVEWeZqb0lo4LZSuSc29ok= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585311292475374.5846336614378; Fri, 27 Mar 2020 05:14:52 -0700 (PDT) Received: from localhost ([::1]:41054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnsx-0001vS-Rk for importer@patchew.org; Fri, 27 Mar 2020 08:14:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35320) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHnpe-0005Jm-74 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHnpd-0002Li-0R for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:25 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:26205) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHnpc-0002Iu-ST for qemu-devel@nongnu.org; Fri, 27 Mar 2020 08:11:24 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-80-7u2zgjSYMm-Rs5pRprkzow-1; Fri, 27 Mar 2020 08:11:20 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB45BDBAC; Fri, 27 Mar 2020 12:11:19 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47409CDBD5; Fri, 27 Mar 2020 12:11:19 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0019731EA0; Fri, 27 Mar 2020 13:11:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585311084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PgO6+1B/924aEFh7adFRZ27OOSLbW6GRY9QNhris/8k=; b=Dhc6MZhJ440UXlPO2Q9+POXWV1AdkoWCG6HkLZknhlmQetvV8C7sg5O13CDo3Ys0ybHgaw NHHCl1Ez4aiKS7oa4VYRx9oZY8kqj6xA6eQC7moFkk4rSPaVL52UfO9+vCMsBEf5LLgzfE suU2q0CVVDsm0bHvV38SqWadfVs3h48= X-MC-Unique: 7u2zgjSYMm-Rs5pRprkzow-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 6/6] acpi: parallel: don't use _STA method Date: Fri, 27 Mar 2020 13:11:11 +0100 Message-Id: <20200327121111.1530-7-kraxel@redhat.com> In-Reply-To: <20200327121111.1530-1-kraxel@redhat.com> References: <20200327121111.1530-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The _STA method dates back to the days where we had a static DSDT. The device is listed in the DSDT table unconditionally and the _STA method checks a bit in the isa bridge pci config space to figure whenever a given is isa device is present or not, then evaluates to 0x0f (present) or 0x00 (absent). These days the DSDT is generated by qemu anyway, so if a device is not present we can simply drop it from the DSDT instead. Signed-off-by: Gerd Hoffmann --- hw/i386/acpi-build-pc.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/hw/i386/acpi-build-pc.c b/hw/i386/acpi-build-pc.c index 97af5eac3d79..8bab105d5e44 100644 --- a/hw/i386/acpi-build-pc.c +++ b/hw/i386/acpi-build-pc.c @@ -1169,39 +1169,26 @@ static Aml *build_mouse_device_aml(void) return dev; } =20 -static Aml *build_lpt_device_aml(void) +static void build_lpt_device_aml(Aml *scope) { Aml *dev; Aml *crs; - Aml *method; - Aml *if_ctx; - Aml *else_ctx; - Aml *zero =3D aml_int(0); - Aml *is_present =3D aml_local(0); + + if (!memory_region_present(get_system_io(), 0x0378)) { + return; + } =20 dev =3D aml_device("LPT"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0400"))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_store(aml_name("LPEN"), is_present)); - if_ctx =3D aml_if(aml_equal(is_present, zero)); - { - aml_append(if_ctx, aml_return(aml_int(0x00))); - } - aml_append(method, if_ctx); - else_ctx =3D aml_else(); - { - aml_append(else_ctx, aml_return(aml_int(0x0f))); - } - aml_append(method, else_ctx); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08)); aml_append(crs, aml_irq_no_flags(7)); aml_append(dev, aml_name_decl("_CRS", crs)); =20 - return dev; + aml_append(scope, dev); } =20 static void build_com_device_aml(Aml *scope, uint8_t uid) @@ -1248,7 +1235,7 @@ static void build_isa_devices_aml(Aml *table) if (fdc) { aml_append(scope, build_fdc_device_aml(fdc)); } - aml_append(scope, build_lpt_device_aml()); + build_lpt_device_aml(scope); build_com_device_aml(scope, 1); build_com_device_aml(scope, 2); =20 --=20 2.18.2