qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT 0c25743] Introduce is_default field for QEMUMachi


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 0c25743] Introduce is_default field for QEMUMachine
Date: Fri, 22 May 2009 01:57:42 -0000

From: Anthony Liguori <address@hidden>

f80f9ec changed the order that machines are registered which had the effect of
changing the default machine.  This changeset introduces a new is_default field
so that machine types can declare that they are the default for an architecture.

Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/hw/boards.h b/hw/boards.h
index 3144017..f6733b7 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -16,11 +16,11 @@ typedef struct QEMUMachine {
     QEMUMachineInitFunc *init;
     int use_scsi;
     int max_cpus;
+    int is_default;
     struct QEMUMachine *next;
 } QEMUMachine;
 
 int qemu_register_machine(QEMUMachine *m);
-void register_machines(void);
 
 extern QEMUMachine *current_machine;
 
diff --git a/hw/etraxfs.c b/hw/etraxfs.c
index 27205ad..f043c19 100644
--- a/hw/etraxfs.c
+++ b/hw/etraxfs.c
@@ -162,6 +162,7 @@ static QEMUMachine bareetraxfs_machine = {
     .name = "bareetraxfs",
     .desc = "Bare ETRAX FS board",
     .init = bareetraxfs_init,
+    .is_default = 1,
 };
 
 static void bareetraxfs_machine_init(void)
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index ac0bd26..493866c 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -512,6 +512,7 @@ static QEMUMachine integratorcp_machine = {
     .name = "integratorcp",
     .desc = "ARM Integrator/CP (ARM926EJ-S)",
     .init = integratorcp_init,
+    .is_default = 1,
 };
 
 static void integratorcp_machine_init(void)
diff --git a/hw/mcf5208.c b/hw/mcf5208.c
index 21b2bc8..47a0f3e 100644
--- a/hw/mcf5208.c
+++ b/hw/mcf5208.c
@@ -290,6 +290,7 @@ static QEMUMachine mcf5208evb_machine = {
     .name = "mcf5208evb",
     .desc = "MCF5206EVB",
     .init = mcf5208evb_init,
+    .is_default = 1,
 };
 
 static void mcf5208evb_machine_init(void)
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index eb81edf..d862182 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -953,6 +953,7 @@ static QEMUMachine mips_malta_machine = {
     .name = "malta",
     .desc = "MIPS Malta Core LV",
     .init = mips_malta_init,
+    .is_default = 1,
 };
 
 static void mips_malta_machine_init(void)
diff --git a/hw/pc.c b/hw/pc.c
index 43b7391..e9682fa 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1189,6 +1189,7 @@ static QEMUMachine pc_machine = {
     .desc = "Standard PC",
     .init = pc_init_pci,
     .max_cpus = 255,
+    .is_default = 1,
 };
 
 static QEMUMachine isapc_machine = {
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index c6ec635..377ed59 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -386,6 +386,7 @@ static QEMUMachine heathrow_machine = {
     .desc = "Heathrow based PowerMAC",
     .init = ppc_heathrow_init,
     .max_cpus = MAX_CPUS,
+    .is_default = 1,
 };
 
 static void heathrow_machine_init(void)
diff --git a/hw/shix.c b/hw/shix.c
index eeee6bb..19b0155 100644
--- a/hw/shix.c
+++ b/hw/shix.c
@@ -92,6 +92,7 @@ static QEMUMachine shix_machine = {
     .name = "shix",
     .desc = "shix card",
     .init = shix_init,
+    .is_default = 1,
 };
 
 static void shix_machine_init(void)
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 1c0f467..a2e0231 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -1037,6 +1037,7 @@ static QEMUMachine ss5_machine = {
     .desc = "Sun4m platform, SPARCstation 5",
     .init = ss5_init,
     .use_scsi = 1,
+    .is_default = 1,
 };
 
 static QEMUMachine ss10_machine = {
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 1ff0efa..08789bc 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -594,6 +594,7 @@ static QEMUMachine sun4u_machine = {
     .desc = "Sun4u platform",
     .init = sun4u_init,
     .max_cpus = 1, // XXX for now
+    .is_default = 1,
 };
 
 static QEMUMachine sun4v_machine = {
diff --git a/vl.c b/vl.c
index a0ce977..a24692c 100644
--- a/vl.c
+++ b/vl.c
@@ -3497,6 +3497,18 @@ static QEMUMachine *find_machine(const char *name)
     return NULL;
 }
 
+static QEMUMachine *find_default_machine(void)
+{
+    QEMUMachine *m;
+
+    for(m = first_machine; m != NULL; m = m->next) {
+        if (m->is_default) {
+            return m;
+        }
+    }
+    return NULL;
+}
+
 /***********************************************************/
 /* main execution loop */
 
@@ -4876,7 +4888,7 @@ int main(int argc, char **argv, char **envp)
 #endif
 
     module_call_init(MODULE_INIT_MACHINE);
-    machine = first_machine;
+    machine = find_default_machine();
     cpu_model = NULL;
     initrd_filename = NULL;
     ram_size = 0;
@@ -4967,7 +4979,7 @@ int main(int argc, char **argv, char **envp)
                     for(m = first_machine; m != NULL; m = m->next) {
                         printf("%-10s %s%s\n",
                                m->name, m->desc,
-                               m == first_machine ? " (default)" : "");
+                               m->is_default ? " (default)" : "");
                     }
                     exit(*optarg != '?');
                 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]