Commit f80f9ec9a63bb2200d614feb658a77b78f9a4bba

Authored by Anthony Liguori
1 parent f92f8afe

Convert machine registration to use module init functions

This cleans up quite a lot of #ifdefs, extern variables, and other ugliness.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/an5206.c
... ... @@ -84,8 +84,15 @@ static void an5206_init(ram_addr_t ram_size,
84 84 env->pc = entry;
85 85 }
86 86  
87   -QEMUMachine an5206_machine = {
  87 +static QEMUMachine an5206_machine = {
88 88 .name = "an5206",
89 89 .desc = "Arnewsh 5206",
90 90 .init = an5206_init,
91 91 };
  92 +
  93 +static void an5206_machine_init(void)
  94 +{
  95 + qemu_register_machine(&an5206_machine);
  96 +}
  97 +
  98 +machine_init(an5206_machine_init);
... ...
hw/axis_dev88.c
... ... @@ -372,8 +372,15 @@ void axisdev88_init (ram_addr_t ram_size,
372 372 printf ("ram size =%ld\n", ram_size);
373 373 }
374 374  
375   -QEMUMachine axisdev88_machine = {
  375 +static QEMUMachine axisdev88_machine = {
376 376 .name = "axis-dev88",
377 377 .desc = "AXIS devboard 88",
378 378 .init = axisdev88_init,
379 379 };
  380 +
  381 +static void axisdev88_machine_init(void)
  382 +{
  383 + qemu_register_machine(&axisdev88_machine);
  384 +}
  385 +
  386 +machine_init(axisdev88_machine_init);
... ...
hw/boards.h
... ... @@ -24,111 +24,4 @@ void register_machines(void);
24 24  
25 25 extern QEMUMachine *current_machine;
26 26  
27   -/* Axis ETRAX. */
28   -extern QEMUMachine bareetraxfs_machine;
29   -extern QEMUMachine axisdev88_machine;
30   -
31   -/* pc.c */
32   -extern QEMUMachine pc_machine;
33   -extern QEMUMachine isapc_machine;
34   -
35   -/* xen_machine.c */
36   -extern QEMUMachine xenpv_machine;
37   -
38   -/* ppc.c */
39   -extern QEMUMachine prep_machine;
40   -extern QEMUMachine core99_machine;
41   -extern QEMUMachine heathrow_machine;
42   -extern QEMUMachine ref405ep_machine;
43   -extern QEMUMachine taihu_machine;
44   -extern QEMUMachine bamboo_machine;
45   -extern QEMUMachine mpc8544ds_machine;
46   -
47   -/* mips_r4k.c */
48   -extern QEMUMachine mips_machine;
49   -
50   -/* mips_jazz.c */
51   -extern QEMUMachine mips_magnum_machine;
52   -extern QEMUMachine mips_pica61_machine;
53   -
54   -/* mips_malta.c */
55   -extern QEMUMachine mips_malta_machine;
56   -
57   -/* mips_mipssim.c */
58   -extern QEMUMachine mips_mipssim_machine;
59   -
60   -/* shix.c */
61   -extern QEMUMachine shix_machine;
62   -
63   -/* r2d.c */
64   -extern QEMUMachine r2d_machine;
65   -
66   -/* sun4m.c */
67   -extern QEMUMachine ss5_machine, ss10_machine, ss600mp_machine, ss20_machine;
68   -extern QEMUMachine voyager_machine, ss_lx_machine, ss4_machine, scls_machine;
69   -extern QEMUMachine sbook_machine;
70   -extern QEMUMachine ss2_machine;
71   -extern QEMUMachine ss1000_machine, ss2000_machine;
72   -
73   -/* sun4u.c */
74   -extern QEMUMachine sun4u_machine;
75   -extern QEMUMachine sun4v_machine;
76   -extern QEMUMachine niagara_machine;
77   -
78   -/* integratorcp.c */
79   -extern QEMUMachine integratorcp_machine;
80   -
81   -/* versatilepb.c */
82   -extern QEMUMachine versatilepb_machine;
83   -extern QEMUMachine versatileab_machine;
84   -
85   -/* realview.c */
86   -extern QEMUMachine realview_machine;
87   -
88   -/* spitz.c */
89   -extern QEMUMachine akitapda_machine;
90   -extern QEMUMachine spitzpda_machine;
91   -extern QEMUMachine borzoipda_machine;
92   -extern QEMUMachine terrierpda_machine;
93   -
94   -/* omap_sx1.c */
95   -extern QEMUMachine sx1_machine_v1;
96   -extern QEMUMachine sx1_machine_v2;
97   -
98   -/* palm.c */
99   -extern QEMUMachine palmte_machine;
100   -
101   -/* nseries.c */
102   -extern QEMUMachine n800_machine;
103   -extern QEMUMachine n810_machine;
104   -
105   -/* gumstix.c */
106   -extern QEMUMachine connex_machine;
107   -extern QEMUMachine verdex_machine;
108   -
109   -/* stellaris.c */
110   -extern QEMUMachine lm3s811evb_machine;
111   -extern QEMUMachine lm3s6965evb_machine;
112   -
113   -/* an5206.c */
114   -extern QEMUMachine an5206_machine;
115   -
116   -/* mcf5208.c */
117   -extern QEMUMachine mcf5208evb_machine;
118   -
119   -/* dummy_m68k.c */
120   -extern QEMUMachine dummy_m68k_machine;
121   -
122   -/* mainstone.c */
123   -extern QEMUMachine mainstone2_machine;
124   -
125   -/* musicpal.c */
126   -extern QEMUMachine musicpal_machine;
127   -
128   -/* tosa.c */
129   -extern QEMUMachine tosapda_machine;
130   -
131   -/* syborg.c */
132   -extern QEMUMachine syborg_machine;
133   -
134 27 #endif
... ...
hw/dummy_m68k.c
... ... @@ -63,8 +63,15 @@ static void dummy_m68k_init(ram_addr_t ram_size,
63 63 env->pc = entry;
64 64 }
65 65  
66   -QEMUMachine dummy_m68k_machine = {
  66 +static QEMUMachine dummy_m68k_machine = {
67 67 .name = "dummy",
68 68 .desc = "Dummy board",
69 69 .init = dummy_m68k_init,
70 70 };
  71 +
  72 +static void dummy_m68k_machine_init(void)
  73 +{
  74 + qemu_register_machine(&dummy_m68k_machine);
  75 +}
  76 +
  77 +machine_init(dummy_m68k_machine_init);
... ...
hw/etraxfs.c
... ... @@ -158,8 +158,15 @@ void bareetraxfs_init (ram_addr_t ram_size,
158 158 printf ("ram size =%ld\n", ram_size);
159 159 }
160 160  
161   -QEMUMachine bareetraxfs_machine = {
  161 +static QEMUMachine bareetraxfs_machine = {
162 162 .name = "bareetraxfs",
163 163 .desc = "Bare ETRAX FS board",
164 164 .init = bareetraxfs_init,
165 165 };
  166 +
  167 +static void bareetraxfs_machine_init(void)
  168 +{
  169 + qemu_register_machine(&bareetraxfs_machine);
  170 +}
  171 +
  172 +machine_init(bareetraxfs_machine_init);
... ...
hw/gumstix.c
... ... @@ -109,14 +109,22 @@ static void verdex_init(ram_addr_t ram_size,
109 109 pxa2xx_gpio_in_get(cpu->gpio)[99]);
110 110 }
111 111  
112   -QEMUMachine connex_machine = {
  112 +static QEMUMachine connex_machine = {
113 113 .name = "connex",
114 114 .desc = "Gumstix Connex (PXA255)",
115 115 .init = connex_init,
116 116 };
117 117  
118   -QEMUMachine verdex_machine = {
  118 +static QEMUMachine verdex_machine = {
119 119 .name = "verdex",
120 120 .desc = "Gumstix Verdex (PXA270)",
121 121 .init = verdex_init,
122 122 };
  123 +
  124 +static void gumstix_machine_init(void)
  125 +{
  126 + qemu_register_machine(&connex_machine);
  127 + qemu_register_machine(&verdex_machine);
  128 +}
  129 +
  130 +machine_init(gumstix_machine_init);
... ...
hw/integratorcp.c
... ... @@ -508,12 +508,19 @@ static void integratorcp_init(ram_addr_t ram_size,
508 508 arm_load_kernel(env, &integrator_binfo);
509 509 }
510 510  
511   -QEMUMachine integratorcp_machine = {
  511 +static QEMUMachine integratorcp_machine = {
512 512 .name = "integratorcp",
513 513 .desc = "ARM Integrator/CP (ARM926EJ-S)",
514 514 .init = integratorcp_init,
515 515 };
516 516  
  517 +static void integratorcp_machine_init(void)
  518 +{
  519 + qemu_register_machine(&integratorcp_machine);
  520 +}
  521 +
  522 +machine_init(integratorcp_machine_init);
  523 +
517 524 static void integratorcp_register_devices(void)
518 525 {
519 526 sysbus_register_dev("integrator_pic", sizeof(icp_pic_state), icp_pic_init);
... ...
hw/mainstone.c
... ... @@ -135,8 +135,15 @@ static void mainstone_init(ram_addr_t ram_size,
135 135 kernel_cmdline, initrd_filename, cpu_model, mainstone, 0x196);
136 136 }
137 137  
138   -QEMUMachine mainstone2_machine = {
  138 +static QEMUMachine mainstone2_machine = {
139 139 .name = "mainstone",
140 140 .desc = "Mainstone II (PXA27x)",
141 141 .init = mainstone_init,
142 142 };
  143 +
  144 +static void mainstone_machine_init(void)
  145 +{
  146 + qemu_register_machine(&mainstone2_machine);
  147 +}
  148 +
  149 +machine_init(mainstone_machine_init);
... ...
hw/mcf5208.c
... ... @@ -286,8 +286,15 @@ static void mcf5208evb_init(ram_addr_t ram_size,
286 286 env->pc = entry;
287 287 }
288 288  
289   -QEMUMachine mcf5208evb_machine = {
  289 +static QEMUMachine mcf5208evb_machine = {
290 290 .name = "mcf5208evb",
291 291 .desc = "MCF5206EVB",
292 292 .init = mcf5208evb_init,
293 293 };
  294 +
  295 +static void mcf5208evb_machine_init(void)
  296 +{
  297 + qemu_register_machine(&mcf5208evb_machine);
  298 +}
  299 +
  300 +machine_init(mcf5208evb_machine_init);
... ...
hw/mips_jazz.c
... ... @@ -286,16 +286,24 @@ void mips_pica61_init (ram_addr_t ram_size,
286 286 mips_jazz_init(ram_size, cpu_model, JAZZ_PICA61);
287 287 }
288 288  
289   -QEMUMachine mips_magnum_machine = {
  289 +static QEMUMachine mips_magnum_machine = {
290 290 .name = "magnum",
291 291 .desc = "MIPS Magnum",
292 292 .init = mips_magnum_init,
293 293 .use_scsi = 1,
294 294 };
295 295  
296   -QEMUMachine mips_pica61_machine = {
  296 +static QEMUMachine mips_pica61_machine = {
297 297 .name = "pica61",
298 298 .desc = "Acer Pica 61",
299 299 .init = mips_pica61_init,
300 300 .use_scsi = 1,
301 301 };
  302 +
  303 +static void mips_jazz_machine_init(void)
  304 +{
  305 + qemu_register_machine(&mips_magnum_machine);
  306 + qemu_register_machine(&mips_pica61_machine);
  307 +}
  308 +
  309 +machine_init(mips_jazz_machine_init);
... ...
hw/mips_malta.c
... ... @@ -949,8 +949,15 @@ void mips_malta_init (ram_addr_t ram_size,
949 949 }
950 950 }
951 951  
952   -QEMUMachine mips_malta_machine = {
  952 +static QEMUMachine mips_malta_machine = {
953 953 .name = "malta",
954 954 .desc = "MIPS Malta Core LV",
955 955 .init = mips_malta_init,
956 956 };
  957 +
  958 +static void mips_malta_machine_init(void)
  959 +{
  960 + qemu_register_machine(&mips_malta_machine);
  961 +}
  962 +
  963 +machine_init(mips_malta_machine_init);
... ...
hw/mips_mipssim.c
... ... @@ -178,8 +178,15 @@ mips_mipssim_init (ram_addr_t ram_size,
178 178 mipsnet_init(0x4200, env->irq[2], &nd_table[0]);
179 179 }
180 180  
181   -QEMUMachine mips_mipssim_machine = {
  181 +static QEMUMachine mips_mipssim_machine = {
182 182 .name = "mipssim",
183 183 .desc = "MIPS MIPSsim platform",
184 184 .init = mips_mipssim_init,
185 185 };
  186 +
  187 +static void mips_mipssim_machine_init(void)
  188 +{
  189 + qemu_register_machine(&mips_mipssim_machine);
  190 +}
  191 +
  192 +machine_init(mips_mipssim_machine_init);
... ...
hw/mips_r4k.c
... ... @@ -275,8 +275,15 @@ void mips_r4k_init (ram_addr_t ram_size,
275 275 i8042_init(i8259[1], i8259[12], 0x60);
276 276 }
277 277  
278   -QEMUMachine mips_machine = {
  278 +static QEMUMachine mips_machine = {
279 279 .name = "mips",
280 280 .desc = "mips r4k platform",
281 281 .init = mips_r4k_init,
282 282 };
  283 +
  284 +static void mips_machine_init(void)
  285 +{
  286 + qemu_register_machine(&mips_machine);
  287 +}
  288 +
  289 +machine_init(mips_machine_init);
... ...
hw/musicpal.c
... ... @@ -1596,12 +1596,19 @@ static void musicpal_init(ram_addr_t ram_size,
1596 1596 arm_load_kernel(env, &musicpal_binfo);
1597 1597 }
1598 1598  
1599   -QEMUMachine musicpal_machine = {
  1599 +static QEMUMachine musicpal_machine = {
1600 1600 .name = "musicpal",
1601 1601 .desc = "Marvell 88w8618 / MusicPal (ARM926EJ-S)",
1602 1602 .init = musicpal_init,
1603 1603 };
1604 1604  
  1605 +static void musicpal_machine_init(void)
  1606 +{
  1607 + qemu_register_machine(&musicpal_machine);
  1608 +}
  1609 +
  1610 +machine_init(musicpal_machine_init);
  1611 +
1605 1612 static void musicpal_register_devices(void)
1606 1613 {
1607 1614 sysbus_register_dev("mv88w8618_pic", sizeof(mv88w8618_pic_state),
... ...
hw/nseries.c
... ... @@ -1403,14 +1403,22 @@ static void n810_init(ram_addr_t ram_size,
1403 1403 cpu_model, &n810_binfo, 810);
1404 1404 }
1405 1405  
1406   -QEMUMachine n800_machine = {
  1406 +static QEMUMachine n800_machine = {
1407 1407 .name = "n800",
1408 1408 .desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)",
1409 1409 .init = n800_init,
1410 1410 };
1411 1411  
1412   -QEMUMachine n810_machine = {
  1412 +static QEMUMachine n810_machine = {
1413 1413 .name = "n810",
1414 1414 .desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)",
1415 1415 .init = n810_init,
1416 1416 };
  1417 +
  1418 +static void nseries_machine_init(void)
  1419 +{
  1420 + qemu_register_machine(&n800_machine);
  1421 + qemu_register_machine(&n810_machine);
  1422 +}
  1423 +
  1424 +machine_init(nseries_machine_init);
... ...
hw/omap_sx1.c
... ... @@ -223,14 +223,22 @@ static void sx1_init_v2(ram_addr_t ram_size,
223 223 kernel_cmdline, initrd_filename, cpu_model, 2);
224 224 }
225 225  
226   -QEMUMachine sx1_machine_v2 = {
  226 +static QEMUMachine sx1_machine_v2 = {
227 227 .name = "sx1",
228 228 .desc = "Siemens SX1 (OMAP310) V2",
229 229 .init = sx1_init_v2,
230 230 };
231 231  
232   -QEMUMachine sx1_machine_v1 = {
  232 +static QEMUMachine sx1_machine_v1 = {
233 233 .name = "sx1-v1",
234 234 .desc = "Siemens SX1 (OMAP310) V1",
235 235 .init = sx1_init_v1,
236 236 };
  237 +
  238 +static void sx1_machine_init(void)
  239 +{
  240 + qemu_register_machine(&sx1_machine_v2);
  241 + qemu_register_machine(&sx1_machine_v1);
  242 +}
  243 +
  244 +machine_init(sx1_machine_init);
... ...
hw/palm.c
... ... @@ -275,8 +275,15 @@ static void palmte_init(ram_addr_t ram_size,
275 275 dpy_resize(ds);
276 276 }
277 277  
278   -QEMUMachine palmte_machine = {
  278 +static QEMUMachine palmte_machine = {
279 279 .name = "cheetah",
280 280 .desc = "Palm Tungsten|E aka. Cheetah PDA (OMAP310)",
281 281 .init = palmte_init,
282 282 };
  283 +
  284 +static void palmte_machine_init(void)
  285 +{
  286 + qemu_register_machine(&palmte_machine);
  287 +}
  288 +
  289 +machine_init(palmte_machine_init);
... ...
... ... @@ -1184,16 +1184,24 @@ void cmos_set_s3_resume(void)
1184 1184 rtc_set_memory(rtc_state, 0xF, 0xFE);
1185 1185 }
1186 1186  
1187   -QEMUMachine pc_machine = {
  1187 +static QEMUMachine pc_machine = {
1188 1188 .name = "pc",
1189 1189 .desc = "Standard PC",
1190 1190 .init = pc_init_pci,
1191 1191 .max_cpus = 255,
1192 1192 };
1193 1193  
1194   -QEMUMachine isapc_machine = {
  1194 +static QEMUMachine isapc_machine = {
1195 1195 .name = "isapc",
1196 1196 .desc = "ISA-only PC",
1197 1197 .init = pc_init_isa,
1198 1198 .max_cpus = 1,
1199 1199 };
  1200 +
  1201 +static void pc_machine_init(void)
  1202 +{
  1203 + qemu_register_machine(&pc_machine);
  1204 + qemu_register_machine(&isapc_machine);
  1205 +}
  1206 +
  1207 +machine_init(pc_machine_init);
... ...
hw/ppc405_boards.c
... ... @@ -344,7 +344,7 @@ static void ref405ep_init (ram_addr_t ram_size,
344 344 printf("bdloc %016lx\n", (unsigned long)bdloc);
345 345 }
346 346  
347   -QEMUMachine ref405ep_machine = {
  347 +static QEMUMachine ref405ep_machine = {
348 348 .name = "ref405ep",
349 349 .desc = "ref405ep",
350 350 .init = ref405ep_init,
... ... @@ -624,8 +624,16 @@ static void taihu_405ep_init(ram_addr_t ram_size,
624 624 #endif
625 625 }
626 626  
627   -QEMUMachine taihu_machine = {
  627 +static QEMUMachine taihu_machine = {
628 628 .name = "taihu",
629 629 .desc = "taihu",
630 630 .init = taihu_405ep_init,
631 631 };
  632 +
  633 +static void ppc405_machine_init(void)
  634 +{
  635 + qemu_register_machine(&ref405ep_machine);
  636 + qemu_register_machine(&taihu_machine);
  637 +}
  638 +
  639 +machine_init(ppc405_machine_init);
... ...
hw/ppc440_bamboo.c
... ... @@ -185,8 +185,15 @@ static void bamboo_init(ram_addr_t ram_size,
185 185 kvmppc_init();
186 186 }
187 187  
188   -QEMUMachine bamboo_machine = {
  188 +static QEMUMachine bamboo_machine = {
189 189 .name = "bamboo",
190 190 .desc = "bamboo",
191 191 .init = bamboo_init,
192 192 };
  193 +
  194 +static void bamboo_machine_init(void)
  195 +{
  196 + qemu_register_machine(&bamboo_machine);
  197 +}
  198 +
  199 +machine_init(bamboo_machine_init);
... ...
hw/ppc_newworld.c
... ... @@ -351,9 +351,16 @@ static void ppc_core99_init (ram_addr_t ram_size,
351 351 qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
352 352 }
353 353  
354   -QEMUMachine core99_machine = {
  354 +static QEMUMachine core99_machine = {
355 355 .name = "mac99",
356 356 .desc = "Mac99 based PowerMAC",
357 357 .init = ppc_core99_init,
358 358 .max_cpus = MAX_CPUS,
359 359 };
  360 +
  361 +static void core99_machine_init(void)
  362 +{
  363 + qemu_register_machine(&core99_machine);
  364 +}
  365 +
  366 +machine_init(core99_machine_init);
... ...
hw/ppc_oldworld.c
... ... @@ -381,9 +381,16 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
381 381 qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
382 382 }
383 383  
384   -QEMUMachine heathrow_machine = {
  384 +static QEMUMachine heathrow_machine = {
385 385 .name = "g3beige",
386 386 .desc = "Heathrow based PowerMAC",
387 387 .init = ppc_heathrow_init,
388 388 .max_cpus = MAX_CPUS,
389 389 };
  390 +
  391 +static void heathrow_machine_init(void)
  392 +{
  393 + qemu_register_machine(&heathrow_machine);
  394 +}
  395 +
  396 +machine_init(heathrow_machine_init);
... ...
hw/ppc_prep.c
... ... @@ -756,9 +756,16 @@ static void ppc_prep_init (ram_addr_t ram_size,
756 756 register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL);
757 757 }
758 758  
759   -QEMUMachine prep_machine = {
  759 +static QEMUMachine prep_machine = {
760 760 .name = "prep",
761 761 .desc = "PowerPC PREP platform",
762 762 .init = ppc_prep_init,
763 763 .max_cpus = MAX_CPUS,
764 764 };
  765 +
  766 +static void prep_machine_init(void)
  767 +{
  768 + qemu_register_machine(&prep_machine);
  769 +}
  770 +
  771 +machine_init(prep_machine_init);
... ...
hw/ppce500_mpc8544ds.c
... ... @@ -281,8 +281,15 @@ static void mpc8544ds_init(ram_addr_t ram_size,
281 281 return;
282 282 }
283 283  
284   -QEMUMachine mpc8544ds_machine = {
  284 +static QEMUMachine mpc8544ds_machine = {
285 285 .name = "mpc8544ds",
286 286 .desc = "mpc8544ds",
287 287 .init = mpc8544ds_init,
288 288 };
  289 +
  290 +static void mpc8544ds_machine_init(void)
  291 +{
  292 + qemu_register_machine(&mpc8544ds_machine);
  293 +}
  294 +
  295 +machine_init(mpc8544ds_machine_init);
... ...
hw/r2d.c
... ... @@ -258,8 +258,15 @@ static void r2d_init(ram_addr_t ram_size,
258 258 }
259 259 }
260 260  
261   -QEMUMachine r2d_machine = {
  261 +static QEMUMachine r2d_machine = {
262 262 .name = "r2d",
263 263 .desc = "r2d-plus board",
264 264 .init = r2d_init,
265 265 };
  266 +
  267 +static void r2d_machine_init(void)
  268 +{
  269 + qemu_register_machine(&r2d_machine);
  270 +}
  271 +
  272 +machine_init(r2d_machine_init);
... ...
hw/realview.c
... ... @@ -202,3 +202,10 @@ QEMUMachine realview_machine = {
202 202 .init = realview_init,
203 203 .use_scsi = 1,
204 204 };
  205 +
  206 +static void realview_machine_init(void)
  207 +{
  208 + qemu_register_machine(&realview_machine);
  209 +}
  210 +
  211 +machine_init(realview_machine_init);
... ...
hw/shix.c
... ... @@ -88,8 +88,15 @@ static void shix_init(ram_addr_t ram_size,
88 88 fprintf(stderr, "initialization terminated\n");
89 89 }
90 90  
91   -QEMUMachine shix_machine = {
  91 +static QEMUMachine shix_machine = {
92 92 .name = "shix",
93 93 .desc = "shix card",
94 94 .init = shix_init,
95 95 };
  96 +
  97 +static void shix_machine_init(void)
  98 +{
  99 + qemu_register_machine(&shix_machine);
  100 +}
  101 +
  102 +machine_init(shix_machine_init);
... ...
hw/spitz.c
... ... @@ -1050,24 +1050,34 @@ QEMUMachine akitapda_machine = {
1050 1050 .init = akita_init,
1051 1051 };
1052 1052  
1053   -QEMUMachine spitzpda_machine = {
  1053 +static QEMUMachine spitzpda_machine = {
1054 1054 .name = "spitz",
1055 1055 .desc = "Spitz PDA (PXA270)",
1056 1056 .init = spitz_init,
1057 1057 };
1058 1058  
1059   -QEMUMachine borzoipda_machine = {
  1059 +static QEMUMachine borzoipda_machine = {
1060 1060 .name = "borzoi",
1061 1061 .desc = "Borzoi PDA (PXA270)",
1062 1062 .init = borzoi_init,
1063 1063 };
1064 1064  
1065   -QEMUMachine terrierpda_machine = {
  1065 +static QEMUMachine terrierpda_machine = {
1066 1066 .name = "terrier",
1067 1067 .desc = "Terrier PDA (PXA270)",
1068 1068 .init = terrier_init,
1069 1069 };
1070 1070  
  1071 +static void spitz_machine_init(void)
  1072 +{
  1073 + qemu_register_machine(&akitapda_machine);
  1074 + qemu_register_machine(&spitzpda_machine);
  1075 + qemu_register_machine(&borzoipda_machine);
  1076 + qemu_register_machine(&terrierpda_machine);
  1077 +}
  1078 +
  1079 +machine_init(spitz_machine_init);
  1080 +
1071 1081 static SSISlaveInfo corgi_ssp_info = {
1072 1082 .init = corgi_ssp_init,
1073 1083 .transfer = corgi_ssp_transfer
... ...
hw/stellaris.c
... ... @@ -1396,18 +1396,26 @@ static void lm3s6965evb_init(ram_addr_t ram_size,
1396 1396 stellaris_init(kernel_filename, cpu_model, &stellaris_boards[1]);
1397 1397 }
1398 1398  
1399   -QEMUMachine lm3s811evb_machine = {
  1399 +static QEMUMachine lm3s811evb_machine = {
1400 1400 .name = "lm3s811evb",
1401 1401 .desc = "Stellaris LM3S811EVB",
1402 1402 .init = lm3s811evb_init,
1403 1403 };
1404 1404  
1405   -QEMUMachine lm3s6965evb_machine = {
  1405 +static QEMUMachine lm3s6965evb_machine = {
1406 1406 .name = "lm3s6965evb",
1407 1407 .desc = "Stellaris LM3S6965EVB",
1408 1408 .init = lm3s6965evb_init,
1409 1409 };
1410 1410  
  1411 +static void stellaris_machine_init(void)
  1412 +{
  1413 + qemu_register_machine(&lm3s811evb_machine);
  1414 + qemu_register_machine(&lm3s6965evb_machine);
  1415 +}
  1416 +
  1417 +machine_init(stellaris_machine_init);
  1418 +
1411 1419 static SSISlaveInfo stellaris_ssi_bus_info = {
1412 1420 .init = stellaris_ssi_bus_init,
1413 1421 .transfer = stellaris_ssi_bus_transfer
... ...
hw/sun4m.c
... ... @@ -1032,14 +1032,14 @@ static void sbook_init(ram_addr_t RAM_size,
1032 1032 kernel_cmdline, initrd_filename, cpu_model);
1033 1033 }
1034 1034  
1035   -QEMUMachine ss5_machine = {
  1035 +static QEMUMachine ss5_machine = {
1036 1036 .name = "SS-5",
1037 1037 .desc = "Sun4m platform, SPARCstation 5",
1038 1038 .init = ss5_init,
1039 1039 .use_scsi = 1,
1040 1040 };
1041 1041  
1042   -QEMUMachine ss10_machine = {
  1042 +static QEMUMachine ss10_machine = {
1043 1043 .name = "SS-10",
1044 1044 .desc = "Sun4m platform, SPARCstation 10",
1045 1045 .init = ss10_init,
... ... @@ -1047,7 +1047,7 @@ QEMUMachine ss10_machine = {
1047 1047 .max_cpus = 4,
1048 1048 };
1049 1049  
1050   -QEMUMachine ss600mp_machine = {
  1050 +static QEMUMachine ss600mp_machine = {
1051 1051 .name = "SS-600MP",
1052 1052 .desc = "Sun4m platform, SPARCserver 600MP",
1053 1053 .init = ss600mp_init,
... ... @@ -1055,7 +1055,7 @@ QEMUMachine ss600mp_machine = {
1055 1055 .max_cpus = 4,
1056 1056 };
1057 1057  
1058   -QEMUMachine ss20_machine = {
  1058 +static QEMUMachine ss20_machine = {
1059 1059 .name = "SS-20",
1060 1060 .desc = "Sun4m platform, SPARCstation 20",
1061 1061 .init = ss20_init,
... ... @@ -1063,35 +1063,35 @@ QEMUMachine ss20_machine = {
1063 1063 .max_cpus = 4,
1064 1064 };
1065 1065  
1066   -QEMUMachine voyager_machine = {
  1066 +static QEMUMachine voyager_machine = {
1067 1067 .name = "Voyager",
1068 1068 .desc = "Sun4m platform, SPARCstation Voyager",
1069 1069 .init = vger_init,
1070 1070 .use_scsi = 1,
1071 1071 };
1072 1072  
1073   -QEMUMachine ss_lx_machine = {
  1073 +static QEMUMachine ss_lx_machine = {
1074 1074 .name = "LX",
1075 1075 .desc = "Sun4m platform, SPARCstation LX",
1076 1076 .init = ss_lx_init,
1077 1077 .use_scsi = 1,
1078 1078 };
1079 1079  
1080   -QEMUMachine ss4_machine = {
  1080 +static QEMUMachine ss4_machine = {
1081 1081 .name = "SS-4",
1082 1082 .desc = "Sun4m platform, SPARCstation 4",
1083 1083 .init = ss4_init,
1084 1084 .use_scsi = 1,
1085 1085 };
1086 1086  
1087   -QEMUMachine scls_machine = {
  1087 +static QEMUMachine scls_machine = {
1088 1088 .name = "SPARCClassic",
1089 1089 .desc = "Sun4m platform, SPARCClassic",
1090 1090 .init = scls_init,
1091 1091 .use_scsi = 1,
1092 1092 };
1093 1093  
1094   -QEMUMachine sbook_machine = {
  1094 +static QEMUMachine sbook_machine = {
1095 1095 .name = "SPARCbook",
1096 1096 .desc = "Sun4m platform, SPARCbook",
1097 1097 .init = sbook_init,
... ... @@ -1335,7 +1335,7 @@ static void ss2000_init(ram_addr_t RAM_size,
1335 1335 kernel_cmdline, initrd_filename, cpu_model);
1336 1336 }
1337 1337  
1338   -QEMUMachine ss1000_machine = {
  1338 +static QEMUMachine ss1000_machine = {
1339 1339 .name = "SS-1000",
1340 1340 .desc = "Sun4d platform, SPARCserver 1000",
1341 1341 .init = ss1000_init,
... ... @@ -1343,7 +1343,7 @@ QEMUMachine ss1000_machine = {
1343 1343 .max_cpus = 8,
1344 1344 };
1345 1345  
1346   -QEMUMachine ss2000_machine = {
  1346 +static QEMUMachine ss2000_machine = {
1347 1347 .name = "SS-2000",
1348 1348 .desc = "Sun4d platform, SPARCcenter 2000",
1349 1349 .init = ss2000_init,
... ... @@ -1543,9 +1543,27 @@ static void ss2_init(ram_addr_t RAM_size,
1543 1543 kernel_cmdline, initrd_filename, cpu_model);
1544 1544 }
1545 1545  
1546   -QEMUMachine ss2_machine = {
  1546 +static QEMUMachine ss2_machine = {
1547 1547 .name = "SS-2",
1548 1548 .desc = "Sun4c platform, SPARCstation 2",
1549 1549 .init = ss2_init,
1550 1550 .use_scsi = 1,
1551 1551 };
  1552 +
  1553 +static void ss2_machine_init(void)
  1554 +{
  1555 + qemu_register_machine(&ss5_machine);
  1556 + qemu_register_machine(&ss10_machine);
  1557 + qemu_register_machine(&ss600mp_machine);
  1558 + qemu_register_machine(&ss20_machine);
  1559 + qemu_register_machine(&voyager_machine);
  1560 + qemu_register_machine(&ss_lx_machine);
  1561 + qemu_register_machine(&ss4_machine);
  1562 + qemu_register_machine(&scls_machine);
  1563 + qemu_register_machine(&sbook_machine);
  1564 + qemu_register_machine(&ss1000_machine);
  1565 + qemu_register_machine(&ss2000_machine);
  1566 + qemu_register_machine(&ss2_machine);
  1567 +}
  1568 +
  1569 +machine_init(ss2_machine_init);
... ...
hw/sun4u.c
... ... @@ -589,23 +589,32 @@ static void niagara_init(ram_addr_t RAM_size,
589 589 kernel_cmdline, initrd_filename, cpu_model, &hwdefs[2]);
590 590 }
591 591  
592   -QEMUMachine sun4u_machine = {
  592 +static QEMUMachine sun4u_machine = {
593 593 .name = "sun4u",
594 594 .desc = "Sun4u platform",
595 595 .init = sun4u_init,
596 596 .max_cpus = 1, // XXX for now
597 597 };
598 598  
599   -QEMUMachine sun4v_machine = {
  599 +static QEMUMachine sun4v_machine = {
600 600 .name = "sun4v",
601 601 .desc = "Sun4v platform",
602 602 .init = sun4v_init,
603 603 .max_cpus = 1, // XXX for now
604 604 };
605 605  
606   -QEMUMachine niagara_machine = {
  606 +static QEMUMachine niagara_machine = {
607 607 .name = "Niagara",
608 608 .desc = "Sun4v platform, Niagara",
609 609 .init = niagara_init,
610 610 .max_cpus = 1, // XXX for now
611 611 };
  612 +
  613 +static void sun4u_machine_init(void)
  614 +{
  615 + qemu_register_machine(&sun4u_machine);
  616 + qemu_register_machine(&sun4v_machine);
  617 + qemu_register_machine(&niagara_machine);
  618 +}
  619 +
  620 +machine_init(sun4u_machine_init);
... ...
hw/syborg.c
... ... @@ -98,8 +98,15 @@ static void syborg_init(ram_addr_t ram_size,
98 98 arm_load_kernel(env, &syborg_binfo);
99 99 }
100 100  
101   -QEMUMachine syborg_machine = {
  101 +static QEMUMachine syborg_machine = {
102 102 .name = "syborg",
103 103 .desc = "Syborg (Symbian Virtual Platform)",
104 104 .init = syborg_init,
105 105 };
  106 +
  107 +static void syborg_machine_init(void)
  108 +{
  109 + qemu_register_machine(&syborg_machine);
  110 +}
  111 +
  112 +machine_init(syborg_machine_init);
... ...
hw/tosa.c
... ... @@ -238,12 +238,19 @@ static void tosa_init(ram_addr_t ram_size,
238 238 sl_bootparam_write(SL_PXA_PARAM_BASE);
239 239 }
240 240  
241   -QEMUMachine tosapda_machine = {
  241 +static QEMUMachine tosapda_machine = {
242 242 .name = "tosa",
243 243 .desc = "Tosa PDA (PXA255)",
244 244 .init = tosa_init,
245 245 };
246 246  
  247 +static void tosapda_machine_init(void)
  248 +{
  249 + qemu_register_machine(&tosapda_machine);
  250 +}
  251 +
  252 +machine_init(tosapda_machine_init);
  253 +
247 254 static I2CSlaveInfo tosa_dac_info = {
248 255 .init = tosa_dac_init,
249 256 .event = tosa_dac_event,
... ...
hw/versatilepb.c
... ... @@ -309,20 +309,28 @@ static void vab_init(ram_addr_t ram_size,
309 309 initrd_filename, cpu_model, 0x25e);
310 310 }
311 311  
312   -QEMUMachine versatilepb_machine = {
  312 +static QEMUMachine versatilepb_machine = {
313 313 .name = "versatilepb",
314 314 .desc = "ARM Versatile/PB (ARM926EJ-S)",
315 315 .init = vpb_init,
316 316 .use_scsi = 1,
317 317 };
318 318  
319   -QEMUMachine versatileab_machine = {
  319 +static QEMUMachine versatileab_machine = {
320 320 .name = "versatileab",
321 321 .desc = "ARM Versatile/AB (ARM926EJ-S)",
322 322 .init = vab_init,
323 323 .use_scsi = 1,
324 324 };
325 325  
  326 +static void versatile_machine_init(void)
  327 +{
  328 + qemu_register_machine(&versatilepb_machine);
  329 + qemu_register_machine(&versatileab_machine);
  330 +}
  331 +
  332 +machine_init(versatile_machine_init);
  333 +
326 334 static void versatilepb_register_devices(void)
327 335 {
328 336 sysbus_register_dev("versatilepb_sic", sizeof(vpb_sic_state),
... ...
hw/xen_machine_pv.c
... ... @@ -110,9 +110,16 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,
110 110 xen_init_display(xen_domid);
111 111 }
112 112  
113   -QEMUMachine xenpv_machine = {
  113 +static QEMUMachine xenpv_machine = {
114 114 .name = "xenpv",
115 115 .desc = "Xen Para-virtualized PC",
116 116 .init = xen_init_pv,
117 117 .max_cpus = 1,
118 118 };
  119 +
  120 +static void xenpv_machine_init(void)
  121 +{
  122 + qemu_register_machine(&xenpv_machine);
  123 +}
  124 +
  125 +machine_init(xenpv_machine_init);
... ...
module.h
... ... @@ -23,11 +23,13 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) { \
23 23 typedef enum {
24 24 MODULE_INIT_BLOCK,
25 25 MODULE_INIT_DEVICE,
  26 + MODULE_INIT_MACHINE,
26 27 MODULE_INIT_MAX
27 28 } module_init_type;
28 29  
29 30 #define block_init(function) module_init(function, MODULE_INIT_BLOCK)
30 31 #define device_init(function) module_init(function, MODULE_INIT_DEVICE)
  32 +#define machine_init(function) module_init(function, MODULE_INIT_MACHINE)
31 33  
32 34 void register_module_init(void (*fn)(void), module_init_type type);
33 35  
... ...
target-arm/machine.c
1 1 #include "hw/hw.h"
2 2 #include "hw/boards.h"
3 3  
4   -void register_machines(void)
5   -{
6   - qemu_register_machine(&integratorcp_machine);
7   - qemu_register_machine(&versatilepb_machine);
8   - qemu_register_machine(&versatileab_machine);
9   - qemu_register_machine(&realview_machine);
10   - qemu_register_machine(&akitapda_machine);
11   - qemu_register_machine(&spitzpda_machine);
12   - qemu_register_machine(&borzoipda_machine);
13   - qemu_register_machine(&terrierpda_machine);
14   - qemu_register_machine(&sx1_machine_v1);
15   - qemu_register_machine(&sx1_machine_v2);
16   - qemu_register_machine(&palmte_machine);
17   - qemu_register_machine(&n800_machine);
18   - qemu_register_machine(&n810_machine);
19   - qemu_register_machine(&lm3s811evb_machine);
20   - qemu_register_machine(&lm3s6965evb_machine);
21   - qemu_register_machine(&connex_machine);
22   - qemu_register_machine(&verdex_machine);
23   - qemu_register_machine(&mainstone2_machine);
24   - qemu_register_machine(&musicpal_machine);
25   - qemu_register_machine(&tosapda_machine);
26   - qemu_register_machine(&syborg_machine);
27   -}
28   -
29 4 void cpu_save(QEMUFile *f, void *opaque)
30 5 {
31 6 int i;
... ...
target-cris/machine.c
1 1 #include "hw/hw.h"
2 2 #include "hw/boards.h"
3 3  
4   -void register_machines(void)
5   -{
6   - qemu_register_machine(&bareetraxfs_machine);
7   - qemu_register_machine(&axisdev88_machine);
8   -}
9   -
10 4 void cpu_save(QEMUFile *f, void *opaque)
11 5 {
12 6 CPUCRISState *env = opaque;
... ...
target-i386/machine.c
... ... @@ -5,15 +5,6 @@
5 5  
6 6 #include "exec-all.h"
7 7  
8   -void register_machines(void)
9   -{
10   - qemu_register_machine(&pc_machine);
11   - qemu_register_machine(&isapc_machine);
12   -#ifdef CONFIG_XEN
13   - qemu_register_machine(&xenpv_machine);
14   -#endif
15   -}
16   -
17 8 static void cpu_put_seg(QEMUFile *f, SegmentCache *dt)
18 9 {
19 10 qemu_put_be32(f, dt->selector);
... ...
target-m68k/machine.c
1   -#include "hw/hw.h"
2   -#include "hw/boards.h"
3   -
4   -void register_machines(void)
5   -{
6   - qemu_register_machine(&mcf5208evb_machine);
7   - qemu_register_machine(&an5206_machine);
8   - qemu_register_machine(&dummy_m68k_machine);
9   -}
target-mips/machine.c
... ... @@ -3,15 +3,6 @@
3 3  
4 4 #include "exec-all.h"
5 5  
6   -void register_machines(void)
7   -{
8   - qemu_register_machine(&mips_malta_machine);
9   - qemu_register_machine(&mips_magnum_machine);
10   - qemu_register_machine(&mips_pica61_machine);
11   - qemu_register_machine(&mips_mipssim_machine);
12   - qemu_register_machine(&mips_machine);
13   -}
14   -
15 6 static void save_tc(QEMUFile *f, TCState *tc)
16 7 {
17 8 int i;
... ...
target-ppc/machine.c
1 1 #include "hw/hw.h"
2 2 #include "hw/boards.h"
3 3  
4   -void register_machines(void)
5   -{
6   - qemu_register_machine(&heathrow_machine);
7   - qemu_register_machine(&core99_machine);
8   - qemu_register_machine(&prep_machine);
9   - qemu_register_machine(&ref405ep_machine);
10   - qemu_register_machine(&taihu_machine);
11   - qemu_register_machine(&bamboo_machine);
12   - qemu_register_machine(&mpc8544ds_machine);
13   -}
14   -
15 4 void cpu_save(QEMUFile *f, void *opaque)
16 5 {
17 6 CPUState *env = (CPUState *)opaque;
... ...
target-sh4/machine.c
1   -#include "hw/hw.h"
2   -#include "hw/boards.h"
3   -
4   -void register_machines(void)
5   -{
6   - qemu_register_machine(&shix_machine);
7   - qemu_register_machine(&r2d_machine);
8   -}
target-sparc/machine.c
... ... @@ -4,28 +4,6 @@
4 4  
5 5 #include "exec-all.h"
6 6  
7   -void register_machines(void)
8   -{
9   -#ifdef TARGET_SPARC64
10   - qemu_register_machine(&sun4u_machine);
11   - qemu_register_machine(&sun4v_machine);
12   - qemu_register_machine(&niagara_machine);
13   -#else
14   - qemu_register_machine(&ss5_machine);
15   - qemu_register_machine(&ss10_machine);
16   - qemu_register_machine(&ss600mp_machine);
17   - qemu_register_machine(&ss20_machine);
18   - qemu_register_machine(&ss2_machine);
19   - qemu_register_machine(&voyager_machine);
20   - qemu_register_machine(&ss_lx_machine);
21   - qemu_register_machine(&ss4_machine);
22   - qemu_register_machine(&scls_machine);
23   - qemu_register_machine(&sbook_machine);
24   - qemu_register_machine(&ss1000_machine);
25   - qemu_register_machine(&ss2000_machine);
26   -#endif
27   -}
28   -
29 7 void cpu_save(QEMUFile *f, void *opaque)
30 8 {
31 9 CPUState *env = opaque;
... ...
... ... @@ -4876,7 +4876,7 @@ int main(int argc, char **argv, char **envp)
4876 4876 }
4877 4877 #endif
4878 4878  
4879   - register_machines();
  4879 + module_call_init(MODULE_INIT_MACHINE);
4880 4880 machine = first_machine;
4881 4881 cpu_model = NULL;
4882 4882 initrd_filename = NULL;
... ...