diff options
author | Helge Deller <deller@gmx.de> | 2024-05-15 23:33:02 +0200 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2024-05-15 23:33:02 +0200 |
commit | 1218f18ec817631603cfb33aa3a9117b7375d345 (patch) | |
tree | 7be85f041f8253857205e37f962c7df40b47c03a /src/parisc/parisc.c | |
parent | c291c2fceaa1620f57177766b5fb5a91f475f29a (diff) | |
download | seabios-hppa-1218f18ec817631603cfb33aa3a9117b7375d345.zip seabios-hppa-1218f18ec817631603cfb33aa3a9117b7375d345.tar.gz seabios-hppa-1218f18ec817631603cfb33aa3a9117b7375d345.tar.bz2 |
parisc: Fix return value of PDC_CACHE/PDC_CACHE_RET_SPID for space id hashing
HP-UX 11 64-bit uses space ID hashing.
If qemu implements the diagnose registers and mfdiag/mtdiag instructions
(qemu > v9.0 required), allow PDC to ask the CPU and return the correct
value of space id hashing bits.
Signed-off-by: Helge Deller <deller@gmx.de>
Suggested-by: Sven Schnelle <svens@stackframe.org>
Diffstat (limited to 'src/parisc/parisc.c')
-rw-r--r-- | src/parisc/parisc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c index 8aec3bc..c5afbf4 100644 --- a/src/parisc/parisc.c +++ b/src/parisc/parisc.c @@ -1656,9 +1656,19 @@ static int pdc_cache(unsigned long *arg) memcpy(result, machine_cache_info, sizeof(*machine_cache_info)); return PDC_OK; - case PDC_CACHE_RET_SPID: /* returns space-ID bits when sr-hasing is enabled */ - memset(result, 0, 32 * sizeof(unsigned long)); - result[0] = 0; + case PDC_CACHE_RET_SPID: + /* + * Return space-ID bits when space register hashing is enabled. + * The Linux kernel disables sr-hashing, while HP-UX 11 (64-bit) uses hashing. + * For details check the assembly in arch/parisc/kernel/pacache.S in the Linux kernel + * and read some analysis here: + * https://patchwork.ozlabs.org/project/qemu-devel/patch/20240324080945.991100-3-svens@stackframe.org/#3289160 + */ + extern long sr_hashing_enabled(void); + if (sr_hashing_enabled() == 0) + result[0] = 0; + else + result[0] = 0xfe0; return PDC_OK; } dprintf(0, "\n\nSeaBIOS: Unimplemented PDC_CACHE function %ld %lx %lx %lx %lx\n", ARG1, ARG2, ARG3, ARG4, ARG5); |