diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2025-02-25 17:30:24 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2025-03-04 12:07:05 +0100 |
commit | 69392de9138fe6d49f96dfae8adfb9cd64e0578e (patch) | |
tree | 41e673d8784470e159f73ca3ef349b73b38ee1d8 | |
parent | 03223b665c675f6f7d05555d9c6a69678c9ab875 (diff) | |
download | qemu-69392de9138fe6d49f96dfae8adfb9cd64e0578e.zip qemu-69392de9138fe6d49f96dfae8adfb9cd64e0578e.tar.gz qemu-69392de9138fe6d49f96dfae8adfb9cd64e0578e.tar.bz2 |
hw/uefi-vars-sysbus: add x64 variant
The x86 variant of the device is mapped on the fixed address 0xfef10000
and uses etc/hardware-info instead of FDT to pass the mapping location
to the edk2 firmware. The latter allows to move the device to a
different location should that turn out to be necessary in the future.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20250225163031.1409078-21-kraxel@redhat.com>
-rw-r--r-- | hw/uefi/var-service-sysbus.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/hw/uefi/var-service-sysbus.c b/hw/uefi/var-service-sysbus.c index 2857298..97da867 100644 --- a/hw/uefi/var-service-sysbus.c +++ b/hw/uefi/var-service-sysbus.c @@ -9,6 +9,7 @@ #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" @@ -75,6 +76,7 @@ static void uefi_vars_sysbus_class_init(ObjectClass *klass, void *data) 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, @@ -84,9 +86,39 @@ static const TypeInfo uefi_vars_sysbus_info = { }; 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) |