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:
		
							parent
							
								
									993fbfdb1b
								
							
						
					
					
						commit
						0c257437b2
					
				| 
						 | 
				
			
			@ -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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -290,6 +290,7 @@ static QEMUMachine mcf5208evb_machine = {
 | 
			
		|||
    .name = "mcf5208evb",
 | 
			
		||||
    .desc = "MCF5206EVB",
 | 
			
		||||
    .init = mcf5208evb_init,
 | 
			
		||||
    .is_default = 1,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void mcf5208evb_machine_init(void)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								hw/pc.c
								
								
								
								
							
							
						
						
									
										1
									
								
								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 = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								vl.c
								
								
								
								
							
							
						
						
									
										16
									
								
								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 != '?');
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue