Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mem: make nvdimm_device_list global
nvdimm_device_list is required for parsing the list for devices
in subsequent patches. Move it to common area.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
---
This looks to break the mips-softmmu build.
The mips depends on CONFIG_NVDIMM_ACPI, adding CONFIG_NVDIMM looks wrong.
Is there some CONFIG tweak I need to do here? OR

Should I move these functions to utilities like I have
done here -(1b8eaea)?
  • Loading branch information
ShivaprasadGBhat committed May 13, 2019
1 parent df06df4 commit 00512a2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
27 changes: 0 additions & 27 deletions hw/acpi/nvdimm.c
Expand Up @@ -33,33 +33,6 @@
#include "hw/nvram/fw_cfg.h"
#include "hw/mem/nvdimm.h"

static int nvdimm_device_list(Object *obj, void *opaque)
{
GSList **list = opaque;

if (object_dynamic_cast(obj, TYPE_NVDIMM)) {
*list = g_slist_append(*list, DEVICE(obj));
}

object_child_foreach(obj, nvdimm_device_list, opaque);
return 0;
}

/*
* inquire NVDIMM devices and link them into the list which is
* returned to the caller.
*
* Note: it is the caller's responsibility to free the list to avoid
* memory leak.
*/
static GSList *nvdimm_get_device_list(void)
{
GSList *list = NULL;

object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list);
return list;
}

#define NVDIMM_UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
(b) & 0xff, ((b) >> 8) & 0xff, (c) & 0xff, ((c) >> 8) & 0xff, \
Expand Down
27 changes: 27 additions & 0 deletions hw/mem/nvdimm.c
Expand Up @@ -29,6 +29,33 @@
#include "hw/mem/nvdimm.h"
#include "hw/mem/memory-device.h"

static int nvdimm_device_list(Object *obj, void *opaque)
{
GSList **list = opaque;

if (object_dynamic_cast(obj, TYPE_NVDIMM)) {
*list = g_slist_append(*list, DEVICE(obj));
}

object_child_foreach(obj, nvdimm_device_list, opaque);
return 0;
}

/*
* inquire NVDIMM devices and link them into the list which is
* returned to the caller.
*
* Note: it is the caller's responsibility to free the list to avoid
* memory leak.
*/
GSList *nvdimm_get_device_list(void)
{
GSList *list = NULL;

object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list);
return list;
}

static void nvdimm_get_label_size(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
Expand Down
2 changes: 2 additions & 0 deletions include/hw/mem/nvdimm.h
Expand Up @@ -150,4 +150,6 @@ void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data,
uint32_t ram_slots);
void nvdimm_plug(NVDIMMState *state);
void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev);
GSList *nvdimm_get_device_list(void);

#endif

0 comments on commit 00512a2

Please sign in to comment.