Skip to content

Commit

Permalink
hw/hppa: Allow C3700 with 64-bit and B160L with 32-bit CPU only
Browse files Browse the repository at this point in the history
Prevent that users try to boot a 64-bit only C3700 machine with a 32-bit
CPU, and to boot a 32-bit only B160L machine with a 64-bit CPU.

Signed-off-by: Helge Deller <[email protected]>
  • Loading branch information
hdeller authored and rth7680 committed Nov 7, 2023
1 parent fd9b04b commit 3d1611b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions hw/hppa/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ static void machine_HP_B160L_init(MachineState *machine)
/* Create CPUs and RAM. */
translate = machine_HP_common_init_cpus(machine);

if (hppa_is_pa20(&cpu[0]->env)) {
error_report("The HP B160L workstation requires a 32-bit "
"CPU. Use '-machine C3700' instead.");
exit(1);
}

/* Init Lasi chip */
lasi_dev = DEVICE(lasi_init());
memory_region_add_subregion(addr_space, translate(NULL, LASI_HPA),
Expand Down Expand Up @@ -602,6 +608,12 @@ static void machine_HP_C3700_init(MachineState *machine)
/* Create CPUs and RAM. */
translate = machine_HP_common_init_cpus(machine);

if (!hppa_is_pa20(&cpu[0]->env)) {
error_report("The HP C3000 workstation requires a 64-bit CPU. "
"Use '-machine B160L' instead.");
exit(1);
}

/* Init Astro and the Elroys (PCI host bus chips). */
astro = astro_init();
astro_dev = DEVICE(astro);
Expand Down Expand Up @@ -659,13 +671,19 @@ static void hppa_nmi(NMIState *n, int cpu_index, Error **errp)
}
}

static const char *HP_B160L_machine_valid_cpu_types[] = {
TYPE_HPPA_CPU,
NULL
};

static void HP_B160L_machine_init_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
NMIClass *nc = NMI_CLASS(oc);

mc->desc = "HP B160L workstation";
mc->default_cpu_type = TYPE_HPPA_CPU;
mc->valid_cpu_types = HP_B160L_machine_valid_cpu_types;
mc->init = machine_HP_B160L_init;
mc->reset = hppa_machine_reset;
mc->block_default_type = IF_SCSI;
Expand All @@ -690,13 +708,19 @@ static const TypeInfo HP_B160L_machine_init_typeinfo = {
},
};

static const char *HP_C3700_machine_valid_cpu_types[] = {
TYPE_HPPA64_CPU,
NULL
};

static void HP_C3700_machine_init_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
NMIClass *nc = NMI_CLASS(oc);

mc->desc = "HP C3700 workstation";
mc->default_cpu_type = TYPE_HPPA64_CPU;
mc->valid_cpu_types = HP_C3700_machine_valid_cpu_types;
mc->init = machine_HP_C3700_init;
mc->reset = hppa_machine_reset;
mc->block_default_type = IF_SCSI;
Expand Down

0 comments on commit 3d1611b

Please sign in to comment.