Introduce is_default field for QEMUMachine

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 <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2009-05-21 20:41:01 -05:00
parent 993fbfdb1b
commit 0c257437b2
11 changed files with 24 additions and 3 deletions

View File

@ -16,11 +16,11 @@ typedef struct QEMUMachine {
QEMUMachineInitFunc *init; QEMUMachineInitFunc *init;
int use_scsi; int use_scsi;
int max_cpus; int max_cpus;
int is_default;
struct QEMUMachine *next; struct QEMUMachine *next;
} QEMUMachine; } QEMUMachine;
int qemu_register_machine(QEMUMachine *m); int qemu_register_machine(QEMUMachine *m);
void register_machines(void);
extern QEMUMachine *current_machine; extern QEMUMachine *current_machine;

View File

@ -162,6 +162,7 @@ static QEMUMachine bareetraxfs_machine = {
.name = "bareetraxfs", .name = "bareetraxfs",
.desc = "Bare ETRAX FS board", .desc = "Bare ETRAX FS board",
.init = bareetraxfs_init, .init = bareetraxfs_init,
.is_default = 1,
}; };
static void bareetraxfs_machine_init(void) static void bareetraxfs_machine_init(void)

View File

@ -512,6 +512,7 @@ static QEMUMachine integratorcp_machine = {
.name = "integratorcp", .name = "integratorcp",
.desc = "ARM Integrator/CP (ARM926EJ-S)", .desc = "ARM Integrator/CP (ARM926EJ-S)",
.init = integratorcp_init, .init = integratorcp_init,
.is_default = 1,
}; };
static void integratorcp_machine_init(void) static void integratorcp_machine_init(void)

View File

@ -290,6 +290,7 @@ static QEMUMachine mcf5208evb_machine = {
.name = "mcf5208evb", .name = "mcf5208evb",
.desc = "MCF5206EVB", .desc = "MCF5206EVB",
.init = mcf5208evb_init, .init = mcf5208evb_init,
.is_default = 1,
}; };
static void mcf5208evb_machine_init(void) static void mcf5208evb_machine_init(void)

View File

@ -953,6 +953,7 @@ static QEMUMachine mips_malta_machine = {
.name = "malta", .name = "malta",
.desc = "MIPS Malta Core LV", .desc = "MIPS Malta Core LV",
.init = mips_malta_init, .init = mips_malta_init,
.is_default = 1,
}; };
static void mips_malta_machine_init(void) static void mips_malta_machine_init(void)

View File

@ -1189,6 +1189,7 @@ static QEMUMachine pc_machine = {
.desc = "Standard PC", .desc = "Standard PC",
.init = pc_init_pci, .init = pc_init_pci,
.max_cpus = 255, .max_cpus = 255,
.is_default = 1,
}; };
static QEMUMachine isapc_machine = { static QEMUMachine isapc_machine = {

View File

@ -386,6 +386,7 @@ static QEMUMachine heathrow_machine = {
.desc = "Heathrow based PowerMAC", .desc = "Heathrow based PowerMAC",
.init = ppc_heathrow_init, .init = ppc_heathrow_init,
.max_cpus = MAX_CPUS, .max_cpus = MAX_CPUS,
.is_default = 1,
}; };
static void heathrow_machine_init(void) static void heathrow_machine_init(void)

View File

@ -92,6 +92,7 @@ static QEMUMachine shix_machine = {
.name = "shix", .name = "shix",
.desc = "shix card", .desc = "shix card",
.init = shix_init, .init = shix_init,
.is_default = 1,
}; };
static void shix_machine_init(void) static void shix_machine_init(void)

View File

@ -1037,6 +1037,7 @@ static QEMUMachine ss5_machine = {
.desc = "Sun4m platform, SPARCstation 5", .desc = "Sun4m platform, SPARCstation 5",
.init = ss5_init, .init = ss5_init,
.use_scsi = 1, .use_scsi = 1,
.is_default = 1,
}; };
static QEMUMachine ss10_machine = { static QEMUMachine ss10_machine = {

View File

@ -594,6 +594,7 @@ static QEMUMachine sun4u_machine = {
.desc = "Sun4u platform", .desc = "Sun4u platform",
.init = sun4u_init, .init = sun4u_init,
.max_cpus = 1, // XXX for now .max_cpus = 1, // XXX for now
.is_default = 1,
}; };
static QEMUMachine sun4v_machine = { static QEMUMachine sun4v_machine = {

16
vl.c
View File

@ -3497,6 +3497,18 @@ static QEMUMachine *find_machine(const char *name)
return NULL; 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 */ /* main execution loop */
@ -4876,7 +4888,7 @@ int main(int argc, char **argv, char **envp)
#endif #endif
module_call_init(MODULE_INIT_MACHINE); module_call_init(MODULE_INIT_MACHINE);
machine = first_machine; machine = find_default_machine();
cpu_model = NULL; cpu_model = NULL;
initrd_filename = NULL; initrd_filename = NULL;
ram_size = 0; ram_size = 0;
@ -4967,7 +4979,7 @@ int main(int argc, char **argv, char **envp)
for(m = first_machine; m != NULL; m = m->next) { for(m = first_machine; m != NULL; m = m->next) {
printf("%-10s %s%s\n", printf("%-10s %s%s\n",
m->name, m->desc, m->name, m->desc,
m == first_machine ? " (default)" : ""); m->is_default ? " (default)" : "");
} }
exit(*optarg != '?'); exit(*optarg != '?');
} }