From 0ada59604e5b66616617ead890534c3a7261fec6 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Tue, 26 Sep 2023 23:53:28 +0200 Subject: cleanups for HP-UX, keep LASI UART, fix CPUID --- src/parisc/c3700.h | 7 ++----- src/parisc/parisc.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/parisc/c3700.h b/src/parisc/c3700.h index 3a9eb05..3634aeb 100644 --- a/src/parisc/c3700.h +++ b/src/parisc/c3700.h @@ -4,14 +4,11 @@ #define PARISC_MODEL "9000/785/C3700" -// this is original c3700: -// #define PARISC_PDC_MODEL 0x5dc0, 0x481, 0x0, 0x2, 0x777c3e84, 0x100000f0, 0x8, 0xb2, 0xb2 -// HACK: this is B160L (to avoid kernel crash with old qemu which tries to run 64-bit instruction in sr_disable_hash) -#define PARISC_PDC_MODEL 0x5020, 0x481, 0x0, 0x2020202, 0x7794d7fe, 0x100000f0, 0x4, 0xba, 0xba +#define PARISC_PDC_MODEL 0x5dc0, 0x481, 0x0, 0x2, 0x777c3e84, 0x100000f0, 0x8, 0xb2, 0xb2 #define PARISC_PDC_VERSION 0x0301 -#define PARISC_PDC_CPUID 0x026b +#define PARISC_PDC_CPUID 0x01e8 #define PARISC_PDC_CAPABILITIES 0x0007 diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c index 4314872..bba92fc 100644 --- a/src/parisc/parisc.c +++ b/src/parisc/parisc.c @@ -462,7 +462,7 @@ static void remove_parisc_devices(unsigned int num_cpus) /* check if qemu emulates LASI chip (LASI_IAR exists) */ if (*(unsigned long *)(LASI_HPA+16) == 0) { - remove_from_keep_list(LASI_UART_HPA); + /* remove_from_keep_list(LASI_UART_HPA); keep for HP-UX at bootup */ remove_from_keep_list(LASI_LAN_HPA); remove_from_keep_list(LASI_LPT_HPA); } else { @@ -1007,7 +1007,13 @@ static int pdc_model(unsigned int *arg) switch (option) { case PDC_MODEL_INFO: - memcpy(result, ¤t_machine->pdc_model, + /* + * In case we run on a 32-bit only emulation, avoid a kernel crash + * with old qemu versions which will try to run 64-bit instructions + * kernel sr_disable_hash() function + */ + memcpy(result, (cpu_bit_width != 64) ? + &machine_B160L.pdc_model : ¤t_machine->pdc_model, sizeof(current_machine->pdc_model)); return PDC_OK; case PDC_MODEL_VERSIONS: @@ -1031,6 +1037,9 @@ static int pdc_model(unsigned int *arg) return PDC_OK; case PDC_MODEL_CPU_ID: result[0] = current_machine->pdc_cpuid; + /* if CPU does not support 64bits, use the B160L CPUID */ + if (cpu_bit_width != 64) + result[0] = machine_B160L.pdc_cpuid; return PDC_OK; case PDC_MODEL_CAPABILITIES: result[0] = current_machine->pdc_caps; @@ -2221,6 +2230,10 @@ void __VISIBLE start_parisc_firmware(void) char bootdrive = (char)cmdline; // c = hdd, d = CD/DVD show_boot_menu = (linux_kernel_entry == 1); + // detect if we emulate a 32- or 64-bit CPU + asm("mtctl %0,%%cr11 ! mfctl %%cr11,%0\n" : "=&r" (i) : "0" (-1)); + cpu_bit_width = (i == 63) ? 64 : 32; + if (smp_cpus > HPPA_MAX_CPUS) smp_cpus = HPPA_MAX_CPUS; num_online_cpus = smp_cpus; @@ -2377,10 +2390,6 @@ void __VISIBLE start_parisc_firmware(void) chassis_code = 0; - // detect if we emulate a 32- or 64-bit CPU - asm("mtctl %0,%%cr11 ! mfctl %%cr11,%0\n" : "=&r" (i) : "0" (-1)); - cpu_bit_width = (i == 63) ? 64 : 32; - cpu_hz = 100 * PAGE0->mem_10msec; /* Hz of this PARISC */ dprintf(1, "\nPARISC SeaBIOS Firmware, %d x %d-bit PA-RISC CPU at %d.%06d MHz, %d MB RAM.\n", smp_cpus, cpu_bit_width, cpu_hz / 1000000, cpu_hz % 1000000, -- cgit v1.1