aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2023-09-29 19:44:01 +0200
committerHelge Deller <deller@gmx.de>2023-09-29 19:44:01 +0200
commit483a6cdf942d3181cdaec72f1c4a5c2aa632984c (patch)
tree2bb69cc2ee38d57e2b5d2ebd2f099f9670dfd830
parent5f40ad4df2a18bd8a4ec60ae11b26075d735d033 (diff)
downloadseabios-hppa-483a6cdf942d3181cdaec72f1c4a5c2aa632984c.zip
seabios-hppa-483a6cdf942d3181cdaec72f1c4a5c2aa632984c.tar.gz
seabios-hppa-483a6cdf942d3181cdaec72f1c4a5c2aa632984c.tar.bz2
Block TLB only for 32-bit CPUs
-rw-r--r--src/parisc/parisc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c
index 45fb965..1fbd8f2 100644
--- a/src/parisc/parisc.c
+++ b/src/parisc/parisc.c
@@ -1346,6 +1346,10 @@ static int pdc_block_tlb(unsigned int *arg)
{
int ret;
+ /* Block TLB is only supported on 32-bit CPUs */
+ if (cpu_bit_width != 32)
+ return PDC_BAD_PROC;
+
asm(
"ldw (7-0)*%2(%1),%%r26 ! ldw (7-1)*%2(%1),%%r25 ! ldw (7-2)*%2(%1),%%r24 ! ldw (7-3)*%2(%1),%%r23\n"
"ldw (7-4)*%2(%1),%%r22 ! ldw (7-5)*%2(%1),%%r21 ! ldw (7-6)*%2(%1),%%r20 ! ldw (7-7)*%2(%1),%%r19\n"
@@ -2259,9 +2263,12 @@ 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;
+ // detect if we emulate a 32- or 64-bit CPU.
+ // set all bits in cr11, read back, and if the return
+ // value is 63 this is a 64-bit capable CPU.
+ // A 32-bit only CPU returns 31.
+ mtctl(-1UL, 11);
+ cpu_bit_width = (mfctl(11) == 63) ? 64 : 32;
if (smp_cpus > HPPA_MAX_CPUS)
smp_cpus = HPPA_MAX_CPUS;