xref: /openbmc/qemu/hw/core/null-machine.c (revision d45a5270d075ea589f0b0ddcf963a5fea1f500ac)
149ab747fSPaolo Bonzini /*
249ab747fSPaolo Bonzini  * Empty machine
349ab747fSPaolo Bonzini  *
449ab747fSPaolo Bonzini  * Copyright IBM, Corp. 2012
549ab747fSPaolo Bonzini  *
649ab747fSPaolo Bonzini  * Authors:
749ab747fSPaolo Bonzini  *  Anthony Liguori   <aliguori@us.ibm.com>
849ab747fSPaolo Bonzini  *
949ab747fSPaolo Bonzini  * This work is licensed under the terms of the GNU GPL, version 2 or later.
1049ab747fSPaolo Bonzini  * See the COPYING file in the top-level directory.
1149ab747fSPaolo Bonzini  *
1249ab747fSPaolo Bonzini  */
1349ab747fSPaolo Bonzini 
1418c86e2bSPeter Maydell #include "qemu/osdep.h"
153964ec6cSThomas Huth #include "qemu/error-report.h"
1649ab747fSPaolo Bonzini #include "hw/boards.h"
173964ec6cSThomas Huth #include "exec/address-spaces.h"
182e5b09fdSMarkus Armbruster #include "hw/core/cpu.h"
1949ab747fSPaolo Bonzini 
machine_none_init(MachineState * mch)203964ec6cSThomas Huth static void machine_none_init(MachineState *mch)
2149ab747fSPaolo Bonzini {
223964ec6cSThomas Huth     CPUState *cpu = NULL;
233964ec6cSThomas Huth 
242278b939SIgor Mammedov     /* Initialize CPU (if user asked for it) */
252278b939SIgor Mammedov     if (mch->cpu_type) {
262278b939SIgor Mammedov         cpu = cpu_create(mch->cpu_type);
273964ec6cSThomas Huth         if (!cpu) {
283964ec6cSThomas Huth             error_report("Unable to initialize CPU");
293964ec6cSThomas Huth             exit(1);
303964ec6cSThomas Huth         }
313964ec6cSThomas Huth     }
323964ec6cSThomas Huth 
333964ec6cSThomas Huth     /* RAM at address zero */
34c74e7190SIgor Mammedov     if (mch->ram) {
35c74e7190SIgor Mammedov         memory_region_add_subregion(get_system_memory(), 0, mch->ram);
363964ec6cSThomas Huth     }
37991db247SThomas Huth 
38991db247SThomas Huth     if (mch->kernel_filename) {
39991db247SThomas Huth         error_report("The -kernel parameter is not supported "
40991db247SThomas Huth                      "(use the generic 'loader' device instead).");
41991db247SThomas Huth         exit(1);
42991db247SThomas Huth     }
4349ab747fSPaolo Bonzini }
4449ab747fSPaolo Bonzini 
machine_none_machine_init(MachineClass * mc)45e264d29dSEduardo Habkost static void machine_none_machine_init(MachineClass *mc)
4649ab747fSPaolo Bonzini {
47e264d29dSEduardo Habkost     mc->desc = "empty machine";
48e264d29dSEduardo Habkost     mc->init = machine_none_init;
493964ec6cSThomas Huth     mc->max_cpus = 1;
503964ec6cSThomas Huth     mc->default_ram_size = 0;
51c74e7190SIgor Mammedov     mc->default_ram_id = "ram";
52*9e7871b1SPhilippe Mathieu-Daudé     mc->no_serial = 1;
53*9e7871b1SPhilippe Mathieu-Daudé     mc->no_parallel = 1;
54*9e7871b1SPhilippe Mathieu-Daudé     mc->no_floppy = 1;
55*9e7871b1SPhilippe Mathieu-Daudé     mc->no_cdrom = 1;
56*9e7871b1SPhilippe Mathieu-Daudé     mc->no_sdcard = 1;
5749ab747fSPaolo Bonzini }
5849ab747fSPaolo Bonzini 
59e264d29dSEduardo Habkost DEFINE_MACHINE("none", machine_none_machine_init)
60