xref: /openbmc/qemu/target/mips/sysemu/mips-qmp-cmds.c (revision 0c1eccd368af8805ec0fb11e6cf25d0684d37328)
16ba97c48SPhilippe Mathieu-Daudé /*
26ba97c48SPhilippe Mathieu-Daudé  * QEMU MIPS CPU (monitor definitions)
36ba97c48SPhilippe Mathieu-Daudé  *
46ba97c48SPhilippe Mathieu-Daudé  * SPDX-FileCopyrightText: 2012 SUSE LINUX Products GmbH
56ba97c48SPhilippe Mathieu-Daudé  *
66ba97c48SPhilippe Mathieu-Daudé  * SPDX-License-Identifier: LGPL-2.1-or-later
76ba97c48SPhilippe Mathieu-Daudé  */
86ba97c48SPhilippe Mathieu-Daudé 
96ba97c48SPhilippe Mathieu-Daudé #include "qemu/osdep.h"
106ba97c48SPhilippe Mathieu-Daudé #include "qapi/qapi-commands-machine-target.h"
116ba97c48SPhilippe Mathieu-Daudé #include "cpu.h"
126ba97c48SPhilippe Mathieu-Daudé 
mips_cpu_add_definition(gpointer data,gpointer user_data)136ba97c48SPhilippe Mathieu-Daudé static void mips_cpu_add_definition(gpointer data, gpointer user_data)
146ba97c48SPhilippe Mathieu-Daudé {
156ba97c48SPhilippe Mathieu-Daudé     ObjectClass *oc = data;
166ba97c48SPhilippe Mathieu-Daudé     CpuDefinitionInfoList **cpu_list = user_data;
176ba97c48SPhilippe Mathieu-Daudé     CpuDefinitionInfo *info;
186ba97c48SPhilippe Mathieu-Daudé     const char *typename;
196ba97c48SPhilippe Mathieu-Daudé 
206ba97c48SPhilippe Mathieu-Daudé     typename = object_class_get_name(oc);
216ba97c48SPhilippe Mathieu-Daudé     info = g_malloc0(sizeof(*info));
22*4b26aa9fSGavin Shan     info->name = cpu_model_from_type(typename);
236ba97c48SPhilippe Mathieu-Daudé     info->q_typename = g_strdup(typename);
246ba97c48SPhilippe Mathieu-Daudé 
256ba97c48SPhilippe Mathieu-Daudé     QAPI_LIST_PREPEND(*cpu_list, info);
266ba97c48SPhilippe Mathieu-Daudé }
276ba97c48SPhilippe Mathieu-Daudé 
qmp_query_cpu_definitions(Error ** errp)286ba97c48SPhilippe Mathieu-Daudé CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
296ba97c48SPhilippe Mathieu-Daudé {
306ba97c48SPhilippe Mathieu-Daudé     CpuDefinitionInfoList *cpu_list = NULL;
316ba97c48SPhilippe Mathieu-Daudé     GSList *list;
326ba97c48SPhilippe Mathieu-Daudé 
336ba97c48SPhilippe Mathieu-Daudé     list = object_class_get_list(TYPE_MIPS_CPU, false);
346ba97c48SPhilippe Mathieu-Daudé     g_slist_foreach(list, mips_cpu_add_definition, &cpu_list);
356ba97c48SPhilippe Mathieu-Daudé     g_slist_free(list);
366ba97c48SPhilippe Mathieu-Daudé 
376ba97c48SPhilippe Mathieu-Daudé     return cpu_list;
386ba97c48SPhilippe Mathieu-Daudé }
39