@@ -28,6 +28,7 @@ obj-$(CONFIG_SDM) += sdm-platform.o
obj-$(CONFIG_SDM) += sdm-communication-local.o
obj-$(CONFIG_SDM) += sdm-communication-socket.o
obj-$(CONFIG_SDM) += sdm-signal-shboot.o
+obj-$(CONFIG_SDM) += sdm-signal-nboot.o
obj-$(CONFIG_REALVIEW) += arm_sysctl.o
obj-$(CONFIG_NSERIES) += cbus.o
new file mode 100644
@@ -0,0 +1,62 @@
+/*
+ * SDM Signal network boot
+ *
+ * Copyright (C) 2016 - Virtual Open Systems
+ *
+ * Author: Baptiste Reynal <b.reynalb@virtualopensystems.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+#include "hw/misc/sdm-signal-nboot.h"
+
+static int sdm_signal_nboot_hw_ops(SDMSignal *signal, SDMSignalData *data)
+{
+ SDMSignalNBoot *snb = SDM_SIGNAL_NBOOT(signal);
+ HostMemoryBackendNetworkClass *nhmc =
+ MEMORY_BACKEND_NETWORK_GET_CLASS(snb->nhm);
+
+ nhmc->boot(snb->nhm);
+
+ return 0;
+}
+
+static bool sdm_signal_nboot_hw_only(SDMSignal *signal)
+{
+ return true;
+}
+
+static void sdm_signal_nboot_init(Object *obj)
+{
+ SDMSignalNBoot *signal = SDM_SIGNAL_NBOOT(obj);
+
+ object_property_add_link(obj, "nhm",
+ TYPE_MEMORY_BACKEND_NETWORK,
+ (Object **)&signal->nhm,
+ object_property_allow_set_link,
+ OBJ_PROP_LINK_UNREF_ON_RELEASE,
+ &error_abort);
+}
+
+static void sdm_signal_nboot_class_init(ObjectClass *oc, void *data)
+{
+ SDMSignalClass *signalc = SDM_SIGNAL_CLASS(oc);
+
+ signalc->hw_ops = sdm_signal_nboot_hw_ops;
+ signalc->hw_only = sdm_signal_nboot_hw_only;
+}
+
+static const TypeInfo sdm_signal_nboot_info = {
+ .name = TYPE_SDM_SIGNAL_NBOOT,
+ .parent = TYPE_SDM_SIGNAL,
+ .class_init = sdm_signal_nboot_class_init,
+ .instance_size = sizeof(SDMSignalNBoot),
+ .instance_init = sdm_signal_nboot_init,
+};
+
+static void register_types(void)
+{
+ type_register_static(&sdm_signal_nboot_info);
+}
+
+type_init(register_types);
new file mode 100644
@@ -0,0 +1,28 @@
+/*
+ * SDM Signal network boot
+ *
+ * Copyright (C) 2016 - Virtual Open Systems
+ *
+ * Author: Baptiste Reynal <b.reynalb@virtualopensystems.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+#ifndef HW_SDM_SIGNAL_NBOOT_H
+#define HW_SDM_SIGNAL_NBOOT_H
+
+#include "hw/misc/sdm-signal.h"
+#include "sysemu/hostmem-network.h"
+
+#define TYPE_SDM_SIGNAL_NBOOT "sdm-signal-nboot"
+#define SDM_SIGNAL_NBOOT(obj) \
+ OBJECT_CHECK(SDMSignalNBoot, (obj), TYPE_SDM_SIGNAL)
+
+typedef struct SDMSignalNBoot SDMSignalNBoot;
+
+struct SDMSignalNBoot {
+ SDMSignal parent;
+
+ HostMemoryBackendNetwork *nhm;
+};
+#endif
This patch introduces a new signal for SDM device, which triggers the boot of a machine using a network memory. Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com> --- hw/misc/Makefile.objs | 1 + hw/misc/sdm-signal-nboot.c | 62 ++++++++++++++++++++++++++++++++++++++ include/hw/misc/sdm-signal-nboot.h | 28 +++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 hw/misc/sdm-signal-nboot.c create mode 100644 include/hw/misc/sdm-signal-nboot.h