[PATCH v3 16/20] mcdstub: function construct for resets added

Nicolas Eder posted 20 patches 1 year ago
Maintainers: Nicolas Eder <nicolas.eder@lauterbach.com>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, Peter Maydell <peter.maydell@linaro.org>
There is a newer version of this series
[PATCH v3 16/20] mcdstub: function construct for resets added
Posted by Nicolas Eder 1 year ago
---
 include/mcdstub/mcdstub.h |  8 ++++++++
 mcdstub/mcdstub.c         | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/include/mcdstub/mcdstub.h b/include/mcdstub/mcdstub.h
index 0375cf7311..000d832a39 100644
--- a/include/mcdstub/mcdstub.h
+++ b/include/mcdstub/mcdstub.h
@@ -672,6 +672,14 @@ void handle_query_regs_c(GArray *params, void *user_ctx);
  */
 void handle_open_server(GArray *params, void *user_ctx);
 
+/**
+ * handle_reset() - Handler for performing resets.
+ *
+ * This function is currently not in use.
+ * @params: GArray with all TCP packet parameters.
+ */
+void handle_reset(GArray *params, void *user_ctx);
+
 /**
  * handle_query_state() - Handler for the state query.
  *
diff --git a/mcdstub/mcdstub.c b/mcdstub/mcdstub.c
index 6313459bac..1a10bc6c98 100644
--- a/mcdstub/mcdstub.c
+++ b/mcdstub/mcdstub.c
@@ -511,6 +511,16 @@ int mcd_handle_packet(const char *line_buf)
             cmd_parser = &close_core_cmd_desc;
         }
         break;
+    case TCP_CHAR_RESET:
+        {
+            static MCDCmdParseEntry reset_cmd_desc = {
+                .handler = handle_reset,
+            };
+            reset_cmd_desc.cmd = (char[2]) { TCP_CHAR_RESET, '\0' };
+            strcpy(reset_cmd_desc.schema, (char[2]) { ARG_SCHEMA_INT, '\0' });
+            cmd_parser = &reset_cmd_desc;
+        }
+        break;
     default:
         /* command not supported */
         mcd_put_packet("");
@@ -1568,6 +1578,14 @@ void handle_query_regs_c(GArray *params, void *user_ctx)
     mcd_put_strbuf();
 }
 
+void handle_reset(GArray *params, void *user_ctx)
+{
+    /*
+     * int reset_id = get_param(params, 0)->data_int;
+     * TODO: implement resets
+     */
+}
+
 void handle_query_state(GArray *params, void *user_ctx)
 {
     /*
-- 
2.34.1