hw/i386/acpi-build: Resolve redundant attribute
The is_piix4 attribute is set once in one location and read once in another. Doing both in one location allows for removing the attribute altogether. Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20221026133110.91828-3-shentey@gmail.com> Message-Id: <20221028103419.93398-3-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
6f56d6de99
commit
bbaa5c41fa
@ -112,7 +112,6 @@ typedef struct AcpiPmInfo {
|
|||||||
} AcpiPmInfo;
|
} AcpiPmInfo;
|
||||||
|
|
||||||
typedef struct AcpiMiscInfo {
|
typedef struct AcpiMiscInfo {
|
||||||
bool is_piix4;
|
|
||||||
bool has_hpet;
|
bool has_hpet;
|
||||||
#ifdef CONFIG_TPM
|
#ifdef CONFIG_TPM
|
||||||
TPMVersion tpm_version;
|
TPMVersion tpm_version;
|
||||||
@ -281,17 +280,6 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)
|
|||||||
|
|
||||||
static void acpi_get_misc_info(AcpiMiscInfo *info)
|
static void acpi_get_misc_info(AcpiMiscInfo *info)
|
||||||
{
|
{
|
||||||
Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM);
|
|
||||||
Object *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
|
|
||||||
assert(!!piix != !!lpc);
|
|
||||||
|
|
||||||
if (piix) {
|
|
||||||
info->is_piix4 = true;
|
|
||||||
}
|
|
||||||
if (lpc) {
|
|
||||||
info->is_piix4 = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->has_hpet = hpet_find();
|
info->has_hpet = hpet_find();
|
||||||
#ifdef CONFIG_TPM
|
#ifdef CONFIG_TPM
|
||||||
info->tpm_version = tpm_get_version(tpm_find());
|
info->tpm_version = tpm_get_version(tpm_find());
|
||||||
@ -1334,6 +1322,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||||||
AcpiPmInfo *pm, AcpiMiscInfo *misc,
|
AcpiPmInfo *pm, AcpiMiscInfo *misc,
|
||||||
Range *pci_hole, Range *pci_hole64, MachineState *machine)
|
Range *pci_hole, Range *pci_hole64, MachineState *machine)
|
||||||
{
|
{
|
||||||
|
Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM);
|
||||||
|
Object *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
|
||||||
CrsRangeEntry *entry;
|
CrsRangeEntry *entry;
|
||||||
Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs;
|
Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs;
|
||||||
CrsRangeSet crs_range_set;
|
CrsRangeSet crs_range_set;
|
||||||
@ -1354,11 +1344,13 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||||||
AcpiTable table = { .sig = "DSDT", .rev = 1, .oem_id = x86ms->oem_id,
|
AcpiTable table = { .sig = "DSDT", .rev = 1, .oem_id = x86ms->oem_id,
|
||||||
.oem_table_id = x86ms->oem_table_id };
|
.oem_table_id = x86ms->oem_table_id };
|
||||||
|
|
||||||
|
assert(!!piix != !!lpc);
|
||||||
|
|
||||||
acpi_table_begin(&table, table_data);
|
acpi_table_begin(&table, table_data);
|
||||||
dsdt = init_aml_allocator();
|
dsdt = init_aml_allocator();
|
||||||
|
|
||||||
build_dbg_aml(dsdt);
|
build_dbg_aml(dsdt);
|
||||||
if (misc->is_piix4) {
|
if (piix) {
|
||||||
sb_scope = aml_scope("_SB");
|
sb_scope = aml_scope("_SB");
|
||||||
dev = aml_device("PCI0");
|
dev = aml_device("PCI0");
|
||||||
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
|
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
|
||||||
@ -1371,7 +1363,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||||||
build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
|
build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
|
||||||
}
|
}
|
||||||
build_piix4_pci0_int(dsdt);
|
build_piix4_pci0_int(dsdt);
|
||||||
} else {
|
} else if (lpc) {
|
||||||
sb_scope = aml_scope("_SB");
|
sb_scope = aml_scope("_SB");
|
||||||
dev = aml_device("PCI0");
|
dev = aml_device("PCI0");
|
||||||
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
|
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user