mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
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>
This commit is contained in:
parent
03223b665c
commit
69392de913
1 changed files with 32 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
|
||||||
|
#include "hw/uefi/hardware-info.h"
|
||||||
#include "hw/uefi/var-service.h"
|
#include "hw/uefi/var-service.h"
|
||||||
#include "hw/uefi/var-service-api.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);
|
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* generic: hardware discovery via FDT */
|
||||||
static const TypeInfo uefi_vars_sysbus_info = {
|
static const TypeInfo uefi_vars_sysbus_info = {
|
||||||
.name = TYPE_UEFI_VARS_SYSBUS,
|
.name = TYPE_UEFI_VARS_SYSBUS,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
|
@ -84,9 +86,39 @@ static const TypeInfo uefi_vars_sysbus_info = {
|
||||||
};
|
};
|
||||||
module_obj(TYPE_UEFI_VARS_SYSBUS);
|
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)
|
static void uefi_vars_sysbus_register_types(void)
|
||||||
{
|
{
|
||||||
type_register_static(&uefi_vars_sysbus_info);
|
type_register_static(&uefi_vars_sysbus_info);
|
||||||
|
type_register_static(&uefi_vars_x64_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
type_init(uefi_vars_sysbus_register_types)
|
type_init(uefi_vars_sysbus_register_types)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue