From 187db62f09584263f25961f01aa9a0aecf0da83f Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sat, 1 Jan 2022 15:42:45 +0100 Subject: parisc: Add opt/hostid fw_cfg option to change hostid Allow the user to select another hostid value. In HP/UX the "uname -i" command shows the number, and in Linux it's visible in the /proc/cpuinfo output. The default hostid number is 2006243326, any other value can be selected with this qemu command line option: -fw_cfg opt/hostid,string=334455 Signed-off-by: Helge Deller --- src/parisc/parisc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c index 2715c8e..56e68cf 100644 --- a/src/parisc/parisc.c +++ b/src/parisc/parisc.c @@ -839,16 +839,17 @@ static int pdc_pim(unsigned int *arg) return PDC_BAD_PROC; } +static struct pdc_model model = { PARISC_PDC_MODEL }; + static int pdc_model(unsigned int *arg) { - static unsigned long model[] = { PARISC_PDC_MODEL }; static const char model_str[] = PARISC_MODEL; unsigned long option = ARG1; unsigned long *result = (unsigned long *)ARG2; switch (option) { case PDC_MODEL_INFO: - memcpy(result, model, sizeof(model)); + memcpy(result, &model, sizeof(model)); return PDC_OK; case PDC_MODEL_VERSIONS: switch (ARG3) { @@ -866,7 +867,7 @@ static int pdc_model(unsigned int *arg) return PDC_OK; case PDC_MODEL_ENSPEC: case PDC_MODEL_DISPEC: - if (ARG3 != model[7]) + if (ARG3 != model.pot_key) return -20; return PDC_OK; case PDC_MODEL_CPU_ID: @@ -1807,6 +1808,9 @@ void __VISIBLE start_parisc_firmware(void) /* use -fw_cfg opt/pdc_debug,string=255 to enable all firmware debug infos */ pdc_debug = romfile_loadstring_to_int("opt/pdc_debug", 0); + model.sw_id = romfile_loadstring_to_int("opt/hostid", model.sw_id); + dprintf(0, "fw_cfg: machine hostid %lu\n", model.sw_id); + /* Initialize PAGE0 */ memset((void*)PAGE0, 0, sizeof(*PAGE0)); -- cgit v1.1