parisc: Add opt/hostid fw_cfg option to change hostid
Allow the user to select another default hostid value.
In HP/UX the "uname -i" command show the number,
and in Linux it's visible in the /proc/cpuinfo output.
The default hostid number is 2006243326, any other integer value can
be selected with this qemu option:
-fw_cfg opt/hostid,string=334455
Signed-off-by: Helge Deller <deller@gmx.de>
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 @@
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 @@
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 @@
/* 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));