aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2023-09-23 09:24:23 +0200
committerHelge Deller <deller@gmx.de>2023-09-23 09:24:23 +0200
commit73bdddba4ebedbdcb87fdcf7e63a96c73c3606f4 (patch)
treeb228573c8f3a4b6412c13f3c11c8afec8b165c20
parentd23295586a8c8e8e53ac2c04bcc10b505f486741 (diff)
downloadseabios-hppa-73bdddba4ebedbdcb87fdcf7e63a96c73c3606f4.zip
seabios-hppa-73bdddba4ebedbdcb87fdcf7e63a96c73c3606f4.tar.gz
seabios-hppa-73bdddba4ebedbdcb87fdcf7e63a96c73c3606f4.tar.bz2
detect CPU bit width
-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 edf15a1..1b2b3dc 100644
--- a/src/parisc/parisc.c
+++ b/src/parisc/parisc.c
@@ -118,6 +118,7 @@ int sti_font;
char qemu_version[16] = "unknown version";
char qemu_machine[16] = "B160L";
+char cpu_bit_width;
/* Want PDC boot menu? Enable via qemu "-boot menu=on" option. */
unsigned int show_boot_menu;
@@ -2326,9 +2327,13 @@ 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 PA7300LC (PCX-L2) at %d.%06d MHz, %d MB RAM.\n",
- smp_cpus, cpu_hz / 1000000, cpu_hz % 1000000,
+ 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,
ram_size/1024/1024);
if (ram_size < MIN_RAM_SIZE) {
@@ -2368,8 +2373,10 @@ void __VISIBLE start_parisc_firmware(void)
" MHz %s Functional 0 KB\n",
i < 10 ? " ":"", i, i?"Idle ":"Active");
printf("\n\n");
- printf(" Available memory: %u MB\n"
+ printf(" CPU arch: %d-bit (%s)\n"
+ " Available memory: %u MB\n"
" Good memory required: %d MB\n\n",
+ cpu_bit_width, (cpu_bit_width == 64) ? "PA2.0" : "PA1.1",
ram_size/1024/1024, MIN_RAM_SIZE/1024/1024);
// search boot devices