Commit 0c257437b25731d4f44985e4b30b7317f2845b4a

Authored by Anthony Liguori
1 parent 993fbfdb

Introduce is_default field for QEMUMachine

f80f9ec9 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 <aliguori@us.ibm.com>
hw/boards.h
@@ -16,11 +16,11 @@ typedef struct QEMUMachine { @@ -16,11 +16,11 @@ typedef struct QEMUMachine {
16 QEMUMachineInitFunc *init; 16 QEMUMachineInitFunc *init;
17 int use_scsi; 17 int use_scsi;
18 int max_cpus; 18 int max_cpus;
  19 + int is_default;
19 struct QEMUMachine *next; 20 struct QEMUMachine *next;
20 } QEMUMachine; 21 } QEMUMachine;
21 22
22 int qemu_register_machine(QEMUMachine *m); 23 int qemu_register_machine(QEMUMachine *m);
23 -void register_machines(void);  
24 24
25 extern QEMUMachine *current_machine; 25 extern QEMUMachine *current_machine;
26 26
hw/etraxfs.c
@@ -162,6 +162,7 @@ static QEMUMachine bareetraxfs_machine = { @@ -162,6 +162,7 @@ static QEMUMachine bareetraxfs_machine = {
162 .name = "bareetraxfs", 162 .name = "bareetraxfs",
163 .desc = "Bare ETRAX FS board", 163 .desc = "Bare ETRAX FS board",
164 .init = bareetraxfs_init, 164 .init = bareetraxfs_init,
  165 + .is_default = 1,
165 }; 166 };
166 167
167 static void bareetraxfs_machine_init(void) 168 static void bareetraxfs_machine_init(void)
hw/integratorcp.c
@@ -512,6 +512,7 @@ static QEMUMachine integratorcp_machine = { @@ -512,6 +512,7 @@ static QEMUMachine integratorcp_machine = {
512 .name = "integratorcp", 512 .name = "integratorcp",
513 .desc = "ARM Integrator/CP (ARM926EJ-S)", 513 .desc = "ARM Integrator/CP (ARM926EJ-S)",
514 .init = integratorcp_init, 514 .init = integratorcp_init,
  515 + .is_default = 1,
515 }; 516 };
516 517
517 static void integratorcp_machine_init(void) 518 static void integratorcp_machine_init(void)
hw/mcf5208.c
@@ -290,6 +290,7 @@ static QEMUMachine mcf5208evb_machine = { @@ -290,6 +290,7 @@ static QEMUMachine mcf5208evb_machine = {
290 .name = "mcf5208evb", 290 .name = "mcf5208evb",
291 .desc = "MCF5206EVB", 291 .desc = "MCF5206EVB",
292 .init = mcf5208evb_init, 292 .init = mcf5208evb_init,
  293 + .is_default = 1,
293 }; 294 };
294 295
295 static void mcf5208evb_machine_init(void) 296 static void mcf5208evb_machine_init(void)
hw/mips_malta.c
@@ -953,6 +953,7 @@ static QEMUMachine mips_malta_machine = { @@ -953,6 +953,7 @@ static QEMUMachine mips_malta_machine = {
953 .name = "malta", 953 .name = "malta",
954 .desc = "MIPS Malta Core LV", 954 .desc = "MIPS Malta Core LV",
955 .init = mips_malta_init, 955 .init = mips_malta_init,
  956 + .is_default = 1,
956 }; 957 };
957 958
958 static void mips_malta_machine_init(void) 959 static void mips_malta_machine_init(void)
@@ -1189,6 +1189,7 @@ static QEMUMachine pc_machine = { @@ -1189,6 +1189,7 @@ static QEMUMachine pc_machine = {
1189 .desc = "Standard PC", 1189 .desc = "Standard PC",
1190 .init = pc_init_pci, 1190 .init = pc_init_pci,
1191 .max_cpus = 255, 1191 .max_cpus = 255,
  1192 + .is_default = 1,
1192 }; 1193 };
1193 1194
1194 static QEMUMachine isapc_machine = { 1195 static QEMUMachine isapc_machine = {
hw/ppc_oldworld.c
@@ -386,6 +386,7 @@ static QEMUMachine heathrow_machine = { @@ -386,6 +386,7 @@ static QEMUMachine heathrow_machine = {
386 .desc = "Heathrow based PowerMAC", 386 .desc = "Heathrow based PowerMAC",
387 .init = ppc_heathrow_init, 387 .init = ppc_heathrow_init,
388 .max_cpus = MAX_CPUS, 388 .max_cpus = MAX_CPUS,
  389 + .is_default = 1,
389 }; 390 };
390 391
391 static void heathrow_machine_init(void) 392 static void heathrow_machine_init(void)
hw/shix.c
@@ -92,6 +92,7 @@ static QEMUMachine shix_machine = { @@ -92,6 +92,7 @@ static QEMUMachine shix_machine = {
92 .name = "shix", 92 .name = "shix",
93 .desc = "shix card", 93 .desc = "shix card",
94 .init = shix_init, 94 .init = shix_init,
  95 + .is_default = 1,
95 }; 96 };
96 97
97 static void shix_machine_init(void) 98 static void shix_machine_init(void)
hw/sun4m.c
@@ -1037,6 +1037,7 @@ static QEMUMachine ss5_machine = { @@ -1037,6 +1037,7 @@ static QEMUMachine ss5_machine = {
1037 .desc = "Sun4m platform, SPARCstation 5", 1037 .desc = "Sun4m platform, SPARCstation 5",
1038 .init = ss5_init, 1038 .init = ss5_init,
1039 .use_scsi = 1, 1039 .use_scsi = 1,
  1040 + .is_default = 1,
1040 }; 1041 };
1041 1042
1042 static QEMUMachine ss10_machine = { 1043 static QEMUMachine ss10_machine = {
hw/sun4u.c
@@ -594,6 +594,7 @@ static QEMUMachine sun4u_machine = { @@ -594,6 +594,7 @@ static QEMUMachine sun4u_machine = {
594 .desc = "Sun4u platform", 594 .desc = "Sun4u platform",
595 .init = sun4u_init, 595 .init = sun4u_init,
596 .max_cpus = 1, // XXX for now 596 .max_cpus = 1, // XXX for now
  597 + .is_default = 1,
597 }; 598 };
598 599
599 static QEMUMachine sun4v_machine = { 600 static QEMUMachine sun4v_machine = {
@@ -3497,6 +3497,18 @@ static QEMUMachine *find_machine(const char *name) @@ -3497,6 +3497,18 @@ static QEMUMachine *find_machine(const char *name)
3497 return NULL; 3497 return NULL;
3498 } 3498 }
3499 3499
  3500 +static QEMUMachine *find_default_machine(void)
  3501 +{
  3502 + QEMUMachine *m;
  3503 +
  3504 + for(m = first_machine; m != NULL; m = m->next) {
  3505 + if (m->is_default) {
  3506 + return m;
  3507 + }
  3508 + }
  3509 + return NULL;
  3510 +}
  3511 +
3500 /***********************************************************/ 3512 /***********************************************************/
3501 /* main execution loop */ 3513 /* main execution loop */
3502 3514
@@ -4876,7 +4888,7 @@ int main(int argc, char **argv, char **envp) @@ -4876,7 +4888,7 @@ int main(int argc, char **argv, char **envp)
4876 #endif 4888 #endif
4877 4889
4878 module_call_init(MODULE_INIT_MACHINE); 4890 module_call_init(MODULE_INIT_MACHINE);
4879 - machine = first_machine; 4891 + machine = find_default_machine();
4880 cpu_model = NULL; 4892 cpu_model = NULL;
4881 initrd_filename = NULL; 4893 initrd_filename = NULL;
4882 ram_size = 0; 4894 ram_size = 0;
@@ -4967,7 +4979,7 @@ int main(int argc, char **argv, char **envp) @@ -4967,7 +4979,7 @@ int main(int argc, char **argv, char **envp)
4967 for(m = first_machine; m != NULL; m = m->next) { 4979 for(m = first_machine; m != NULL; m = m->next) {
4968 printf("%-10s %s%s\n", 4980 printf("%-10s %s%s\n",
4969 m->name, m->desc, 4981 m->name, m->desc,
4970 - m == first_machine ? " (default)" : ""); 4982 + m->is_default ? " (default)" : "");
4971 } 4983 }
4972 exit(*optarg != '?'); 4984 exit(*optarg != '?');
4973 } 4985 }