mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
hw/uefi-vars-sysbus: qemu platform bus support
Add and register function to create an device tree entry when the device is added to the qemu platform bus. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-ID: <20250225163031.1409078-20-kraxel@redhat.com>
This commit is contained in:
parent
5bb89df2e3
commit
03223b665c
2 changed files with 25 additions and 0 deletions
|
@ -36,6 +36,7 @@
|
|||
#include "hw/vfio/vfio-calxeda-xgmac.h"
|
||||
#include "hw/vfio/vfio-amd-xgbe.h"
|
||||
#include "hw/display/ramfb.h"
|
||||
#include "hw/uefi/var-service-api.h"
|
||||
#include "hw/arm/fdt.h"
|
||||
|
||||
/*
|
||||
|
@ -471,6 +472,28 @@ static int add_tpm_tis_fdt_node(SysBusDevice *sbdev, void *opaque)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int add_uefi_vars_node(SysBusDevice *sbdev, void *opaque)
|
||||
{
|
||||
PlatformBusFDTData *data = opaque;
|
||||
PlatformBusDevice *pbus = data->pbus;
|
||||
const char *parent_node = data->pbus_node_name;
|
||||
void *fdt = data->fdt;
|
||||
uint64_t mmio_base;
|
||||
char *nodename;
|
||||
|
||||
mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
|
||||
nodename = g_strdup_printf("%s/%s@%" PRIx64, parent_node,
|
||||
UEFI_VARS_FDT_NODE, mmio_base);
|
||||
qemu_fdt_add_subnode(fdt, nodename);
|
||||
qemu_fdt_setprop_string(fdt, nodename,
|
||||
"compatible", UEFI_VARS_FDT_COMPAT);
|
||||
qemu_fdt_setprop_sized_cells(fdt, nodename, "reg",
|
||||
1, mmio_base,
|
||||
1, UEFI_VARS_REGS_SIZE);
|
||||
g_free(nodename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int no_fdt_node(SysBusDevice *sbdev, void *opaque)
|
||||
{
|
||||
return 0;
|
||||
|
@ -495,6 +518,7 @@ static const BindingEntry bindings[] = {
|
|||
TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node),
|
||||
#endif
|
||||
TYPE_BINDING(TYPE_RAMFB_DEVICE, no_fdt_node),
|
||||
TYPE_BINDING(TYPE_UEFI_VARS_SYSBUS, add_uefi_vars_node),
|
||||
TYPE_BINDING("", NULL), /* last element */
|
||||
};
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ static void uefi_vars_sysbus_class_init(ObjectClass *klass, void *data)
|
|||
|
||||
dc->realize = uefi_vars_sysbus_realize;
|
||||
dc->vmsd = &vmstate_uefi_vars_sysbus;
|
||||
dc->user_creatable = true;
|
||||
device_class_set_legacy_reset(dc, uefi_vars_sysbus_reset);
|
||||
device_class_set_props(dc, uefi_vars_sysbus_properties);
|
||||
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue