#include "hw/qdev-properties.h"
#include "hw/sysbus.h"
+#include "hw/uefi/hardware-info.h"
#include "hw/uefi/var-service.h"
#include "hw/uefi/var-service-api.h"
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
+/* generic: hardware discovery via FDT */
static const TypeInfo uefi_vars_sysbus_info = {
.name = TYPE_UEFI_VARS_SYSBUS,
.parent = TYPE_SYS_BUS_DEVICE,
};
module_obj(TYPE_UEFI_VARS_SYSBUS);
+static void uefi_vars_x64_realize(DeviceState *dev, Error **errp)
+{
+ HARDWARE_INFO_SIMPLE_DEVICE hwinfo = {
+ .mmio_address = cpu_to_le64(0xfef10000),
+ };
+ SysBusDevice *sysbus = SYS_BUS_DEVICE(dev);
+
+ uefi_vars_sysbus_realize(dev, errp);
+
+ hardware_info_register(HardwareInfoQemuUefiVars,
+ &hwinfo, sizeof(hwinfo));
+ sysbus_mmio_map(sysbus, 0, hwinfo.mmio_address);
+}
+
+static void uefi_vars_x64_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ dc->realize = uefi_vars_x64_realize;
+}
+
+/* x64: hardware discovery via etc/hardware-info fw_cfg */
+static const TypeInfo uefi_vars_x64_info = {
+ .name = TYPE_UEFI_VARS_X64,
+ .parent = TYPE_UEFI_VARS_SYSBUS,
+ .class_init = uefi_vars_x64_class_init,
+};
+module_obj(TYPE_UEFI_VARS_X64);
+
static void uefi_vars_sysbus_register_types(void)
{
type_register_static(&uefi_vars_sysbus_info);
+ type_register_static(&uefi_vars_x64_info);
}
type_init(uefi_vars_sysbus_register_types)