Commit 7b833f5b2188b354e5f03ebf24a8ed1fa06dbfdd
1 parent
bda42033
Sparc64: refactor CPU init
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Showing
1 changed file
with
27 additions
and
19 deletions
hw/sun4u.c
... | ... | @@ -458,32 +458,14 @@ static void ram_register_devices(void) |
458 | 458 | |
459 | 459 | device_init(ram_register_devices); |
460 | 460 | |
461 | -static void sun4uv_init(ram_addr_t RAM_size, | |
462 | - const char *boot_devices, | |
463 | - const char *kernel_filename, const char *kernel_cmdline, | |
464 | - const char *initrd_filename, const char *cpu_model, | |
465 | - const struct hwdef *hwdef) | |
461 | +static CPUState *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef) | |
466 | 462 | { |
467 | 463 | CPUState *env; |
468 | - m48t59_t *nvram; | |
469 | - int linux_boot; | |
470 | - unsigned int i; | |
471 | - long initrd_size, kernel_size; | |
472 | - PCIBus *pci_bus, *pci_bus2, *pci_bus3; | |
473 | 464 | QEMUBH *bh; |
474 | - qemu_irq *irq; | |
475 | - int drive_index; | |
476 | - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; | |
477 | - BlockDriverState *fd[MAX_FD]; | |
478 | - void *fw_cfg; | |
479 | 465 | ResetData *reset_info; |
480 | 466 | |
481 | - linux_boot = (kernel_filename != NULL); | |
482 | - | |
483 | - /* init CPUs */ | |
484 | 467 | if (!cpu_model) |
485 | 468 | cpu_model = hwdef->default_cpu_model; |
486 | - | |
487 | 469 | env = cpu_init(cpu_model); |
488 | 470 | if (!env) { |
489 | 471 | fprintf(stderr, "Unable to find Sparc CPU definition\n"); |
... | ... | @@ -510,6 +492,32 @@ static void sun4uv_init(ram_addr_t RAM_size, |
510 | 492 | env->pc = hwdef->prom_addr + 0x20ULL; |
511 | 493 | env->npc = env->pc + 4; |
512 | 494 | |
495 | + return env; | |
496 | +} | |
497 | + | |
498 | +static void sun4uv_init(ram_addr_t RAM_size, | |
499 | + const char *boot_devices, | |
500 | + const char *kernel_filename, const char *kernel_cmdline, | |
501 | + const char *initrd_filename, const char *cpu_model, | |
502 | + const struct hwdef *hwdef) | |
503 | +{ | |
504 | + CPUState *env; | |
505 | + m48t59_t *nvram; | |
506 | + int linux_boot; | |
507 | + unsigned int i; | |
508 | + long initrd_size, kernel_size; | |
509 | + PCIBus *pci_bus, *pci_bus2, *pci_bus3; | |
510 | + qemu_irq *irq; | |
511 | + int drive_index; | |
512 | + BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; | |
513 | + BlockDriverState *fd[MAX_FD]; | |
514 | + void *fw_cfg; | |
515 | + | |
516 | + linux_boot = (kernel_filename != NULL); | |
517 | + | |
518 | + /* init CPUs */ | |
519 | + env = cpu_devinit(cpu_model, hwdef); | |
520 | + | |
513 | 521 | /* set up devices */ |
514 | 522 | ram_init(0, RAM_size); |
515 | 523 | ... | ... |