aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'hw/acpi')
-rw-r--r--hw/acpi/ipmi-stub.c2
-rw-r--r--hw/acpi/ipmi.c49
2 files changed, 16 insertions, 35 deletions
diff --git a/hw/acpi/ipmi-stub.c b/hw/acpi/ipmi-stub.c
index f525f71c2d..befaf0a882 100644
--- a/hw/acpi/ipmi-stub.c
+++ b/hw/acpi/ipmi-stub.c
@@ -10,6 +10,6 @@
#include "qemu/osdep.h"
#include "hw/acpi/ipmi.h"
-void build_acpi_ipmi_devices(Aml *table, BusState *bus)
+void build_ipmi_dev_aml(AcpiDevAmlIf *adev, Aml *scope)
{
}
diff --git a/hw/acpi/ipmi.c b/hw/acpi/ipmi.c
index c30b44fcf5..a20e57d465 100644
--- a/hw/acpi/ipmi.c
+++ b/hw/acpi/ipmi.c
@@ -62,46 +62,27 @@ static Aml *aml_ipmi_crs(IPMIFwInfo *info)
return crs;
}
-static Aml *aml_ipmi_device(IPMIFwInfo *info)
+void build_ipmi_dev_aml(AcpiDevAmlIf *adev, Aml *scope)
{
Aml *dev;
- uint16_t version = ((info->ipmi_spec_major_revision << 8)
- | (info->ipmi_spec_minor_revision << 4));
+ IPMIFwInfo info = {};
+ IPMIInterface *ii = IPMI_INTERFACE(adev);
+ IPMIInterfaceClass *iic = IPMI_INTERFACE_GET_CLASS(ii);
+ uint16_t version;
- assert(info->ipmi_spec_minor_revision <= 15);
+ iic->get_fwinfo(ii, &info);
+ assert(info.ipmi_spec_minor_revision <= 15);
+ version = ((info.ipmi_spec_major_revision << 8)
+ | (info.ipmi_spec_minor_revision << 4));
- dev = aml_device("MI%d", info->uuid);
+ dev = aml_device("MI%d", info.uuid);
aml_append(dev, aml_name_decl("_HID", aml_eisaid("IPI0001")));
aml_append(dev, aml_name_decl("_STR", aml_string("ipmi_%s",
- info->interface_name)));
- aml_append(dev, aml_name_decl("_UID", aml_int(info->uuid)));
- aml_append(dev, aml_name_decl("_CRS", aml_ipmi_crs(info)));
- aml_append(dev, aml_name_decl("_IFT", aml_int(info->interface_type)));
+ info.interface_name)));
+ aml_append(dev, aml_name_decl("_UID", aml_int(info.uuid)));
+ aml_append(dev, aml_name_decl("_CRS", aml_ipmi_crs(&info)));
+ aml_append(dev, aml_name_decl("_IFT", aml_int(info.interface_type)));
aml_append(dev, aml_name_decl("_SRV", aml_int(version)));
- return dev;
-}
-
-void build_acpi_ipmi_devices(Aml *scope, BusState *bus)
-{
-
- BusChild *kid;
-
- QTAILQ_FOREACH(kid, &bus->children, sibling) {
- IPMIInterface *ii;
- IPMIInterfaceClass *iic;
- IPMIFwInfo info;
- Object *obj = object_dynamic_cast(OBJECT(kid->child),
- TYPE_IPMI_INTERFACE);
-
- if (!obj) {
- continue;
- }
-
- ii = IPMI_INTERFACE(obj);
- iic = IPMI_INTERFACE_GET_CLASS(obj);
- memset(&info, 0, sizeof(info));
- iic->get_fwinfo(ii, &info);
- aml_append(scope, aml_ipmi_device(&info));
- }
+ aml_append(scope, dev);
}