xref: /openbmc/qemu/hw/core/null-machine.c (revision b8116f4c)
1 /*
2  * Empty machine
3  *
4  * Copyright IBM, Corp. 2012
5  *
6  * Authors:
7  *  Anthony Liguori   <aliguori@us.ibm.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10  * See the COPYING file in the top-level directory.
11  *
12  */
13 
14 #include "qemu/osdep.h"
15 #include "qemu/error-report.h"
16 #include "hw/boards.h"
17 #include "exec/address-spaces.h"
18 #include "hw/core/cpu.h"
19 
20 static void machine_none_init(MachineState *mch)
21 {
22     CPUState *cpu = NULL;
23 
24     /* Initialize CPU (if user asked for it) */
25     if (mch->cpu_type) {
26         cpu = cpu_create(mch->cpu_type);
27         if (!cpu) {
28             error_report("Unable to initialize CPU");
29             exit(1);
30         }
31     }
32 
33     /* RAM at address zero */
34     if (mch->ram) {
35         memory_region_add_subregion(get_system_memory(), 0, mch->ram);
36     }
37 
38     if (mch->kernel_filename) {
39         error_report("The -kernel parameter is not supported "
40                      "(use the generic 'loader' device instead).");
41         exit(1);
42     }
43 }
44 
45 static void machine_none_machine_init(MachineClass *mc)
46 {
47     mc->desc = "empty machine";
48     mc->init = machine_none_init;
49     mc->max_cpus = 1;
50     mc->default_ram_size = 0;
51     mc->default_ram_id = "ram";
52     mc->no_serial = 1;
53     mc->no_parallel = 1;
54     mc->no_floppy = 1;
55     mc->no_cdrom = 1;
56     mc->no_sdcard = 1;
57 }
58 
59 DEFINE_MACHINE("none", machine_none_machine_init)
60