@@ -1980,6 +1980,19 @@ static Aml *build_q35_osc_method(void)
return method;
}
+static void build_smb0(Aml *table, int devnr, int func)
+{
+ Aml *sb_scope = aml_scope("_SB");
+ Aml *pci0_scope = aml_scope("PCI0");
+ Aml *dev = aml_device("SMB0");
+
+ aml_append(dev, aml_name_decl("_HID", aml_eisaid("APP0005")));
+ aml_append(dev, aml_name_decl("_ADR", aml_int(devnr << 16 | func)));
+ aml_append(pci0_scope, dev);
+ aml_append(sb_scope, pci0_scope);
+ aml_append(table, sb_scope);
+}
+
static void
build_dsdt(GArray *table_data, GArray *linker,
AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -2044,6 +2057,8 @@ build_dsdt(GArray *table_data, GArray *linker,
build_isa_devices_aml(dsdt);
build_q35_pci0_int(dsdt);
}
+ if (pcms->pci_smbus_devnr != -1)
+ build_smb0(dsdt, pcms->pci_smbus_devnr, pcms->pci_smbus_func);
build_cpu_hotplug_aml(dsdt);
build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base,
@@ -1889,6 +1889,8 @@ static void pc_machine_initfn(Object *obj)
{
PCMachineState *pcms = PC_MACHINE(obj);
+ pcms->pci_smbus_devnr = -1;
+
object_property_add(obj, PC_MACHINE_MEMHP_REGION_SIZE, "int",
pc_machine_get_hotplug_memory_region_size,
NULL, NULL, NULL, &error_abort);
@@ -261,6 +261,8 @@ static void pc_init1(MachineState *machine,
pc_machine_is_smm_enabled(pcms),
&piix4_pm);
smbus_eeprom_init(smbus, 8, NULL, 0);
+ pcms->pci_smbus_devnr = piix3_devfn >> 3;
+ pcms->pci_smbus_func = 3;
object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
TYPE_HOTPLUG_HANDLER,
@@ -244,6 +244,8 @@ static void pc_q35_init(MachineState *machine)
PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC),
0xb100),
8, NULL, 0);
+ pcms->pci_smbus_devnr = ICH9_SMB_DEV;
+ pcms->pci_smbus_func = ICH9_SMB_FUNC;
pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
@@ -72,6 +72,10 @@ struct PCMachineState {
uint64_t numa_nodes;
uint64_t *node_mem;
uint64_t *node_cpu;
+
+ /* SMBus information: */
+ int pci_smbus_devnr;
+ int pci_smbus_func;
};
#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"