Commit Graph

2691 Commits

Author SHA1 Message Date
a691536e40 parisc: add .vimrc editor helper file
Signed-off-by: Helge Deller <deller@gmx.de>
2023-10-14 13:39:42 +02:00
f7c373abb9 parisc: Add PDC_CACHE_RET_SPID function
Signed-off-by: Helge Deller <deller@gmx.de>
2023-10-14 13:39:42 +02:00
dc7f119c98 parisc/pdc.h: Add some additional PDC constants
Signed-off-by: Helge Deller <deller@gmx.de>
2023-10-14 13:39:42 +02:00
46554dbde5 parisc: Fix serial output at early bootup
If some bug happens during early bootup, the mem_cons might not have
been initialized yet. In that case use default PARISC_SERIAL_CONSOLE
to show something.

Signed-off-by: Helge Deller <deller@gmx.de>
2023-10-14 13:39:42 +02:00
6f5b0bce32 esp-scsi: handle non-DMA SCSI commands with no data phase
The existing esp-scsi state machine checks for the STAT_TC bit to exit state 1
but in the case where there is no data phase, a non-DMA command is executed
which doesn't set STAT_TC. This only works because QEMU currently always sets
STAT_TC just after issuing every SCSI command.

Update the esp-scsi state machine so that in the case where there is no data
phase, we immediately execute CMD_ICCS instead of waiting for STAT_TC to be
set which will never happen with a non-DMA CMD_SELATN command.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-ID: <20230807065300.366070-4-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2023-09-16 16:29:36 +02:00
a0527d3de1 esp-scsi: check for INTR_BS/INTR_FC instead of STAT_TC for command completion
The ESP SELATN command used to send SCSI commands from the ESP to the SCSI bus
is not a DMA command and therefore does not affect the STAT_TC bit. The only
reason this works at all is due to a bug in QEMU which (currently) always
updates the STAT_TC bit in ESP_RSTAT regardless of the state of the ESP_CMD_DMA
bit.

According to the NCR datasheet [1] the INTR_BS/INTR_FC bits are set when the
SELATN command has completed, so update the existing logic to check for these
bits in ESP_RINTR instead. Note that the read of ESP_RINTR needs to be
restricted to state == 0 as reading ESP_RINTR resets the ESP_RSTAT register
which breaks the STAT_TC check when state == 1.

This commit also includes an extra read of ESP_INTR to clear all the interrupt
bits before submitting the SELATN command to ensure that we don't accidentally
immediately progress to the data phase handling logic where ESP_RINTR bits have
already been set by a previous ESP command.

[1] "NCR 53C94, 53C95, 53C96 Advanced SCSI Controller"
    NCR_53C94_53C95_53C96_Data_Sheet_Feb90.pdf

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20230807065300.366070-3-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2023-09-16 16:29:26 +02:00
844ad96638 esp-scsi: flush FIFO before sending SCSI command
The ESP FIFO is used as a buffer for DMA requests and so isn't guaranteed to
be empty in the case of SCSI errors or a mixed DMA/non-DMA request. Flush the
FIFO before sending a SCSI command to guarantee that it is correctly
positioned at the start of the FIFO.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20230807065300.366070-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2023-09-16 16:29:08 +02:00
763e3b7349 parisc: SEABIOS_HPPA_VERSION 9
Enhancements:
- Support for Block-TLB (BTLB) on 32-bit CPUs

Signed-off-by: Helge Deller <deller@gmx.de>
seabios-hppa-v9
2023-09-13 08:46:33 +02:00
feb446728a parisc: Implement Block-TLB (BTLB) support for 32-bit CPUs
SeaBIOS has no information about the lower implementation details for
Block-TLB (or generic TLB) support, so it simply hands over the
parameters in the CPU registers provided by the operating system to the
PDC_BLOCK_TLB PDC function to QEMU.

Calling QEMU happens via a diagnostics instruction (diag 0x100) which
QEMU will respond to. Older QEMU versions without the BTLB support will
simply log that they ignored the diag instruction, and SeaBIOS will
return PDC_BAD_OPTION for this PDC call in that case.

Signed-off-by: Helge Deller <deller@gmx.de>
2023-09-13 07:57:23 +02:00
673d2595d4 parisc: SEABIOS_HPPA_VERSION 8
Fixes
- boot of HP-UX with SMP, and
- reboot of Linux and HP-UX with SMP

Enhancements:
- show qemu version in boot menu
- adds exit menu entry in boot menu to quit emulation
- allow to trace PCD_CHASSIS codes more specifically

Signed-off-by: Helge Deller <deller@gmx.de>
seabios-hppa-v8
2023-06-24 11:15:12 +02:00
cc940224d4 parisc: Drop unnecessary SMP wake-up code
Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-24 02:19:13 +02:00
50a79cbf00 parisc: Enable PSW_Q bit at bootup
Qemu currently only supports PSW_Q handling, so enable it by default.

Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-24 02:19:13 +02:00
fa008172af parisc: Show qemu version in boot menu
Get the qemu version from the fw_cfg interface and show it
during bootup.

Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-24 02:19:13 +02:00
a385f17c5c parisc: Move boot_args[] to pad608 to fix HP-UX SMP boot
Do not store the boot args in the pad0 field of PAGE0.
This breaks booting HP-UX SMP kernels.
Use pad608 instead.

Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-24 02:19:13 +02:00
a07fa30fde parisc: Add exit option to boot menu
Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-21 17:35:22 +02:00
af6d283cd3 parisc: Add code to show PDC_CHASSIS codes at runtime
Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-21 17:15:40 +02:00
19de2b419c parisc: Fix SMP reboot
Most important is the flushing of the TLB entries

Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-21 17:14:46 +02:00
e957f3e22f parisc: Move SeaBIOS-hppa version string
This allows to include the version number in the binary
header of hppa-firmware.img

Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-21 17:09:38 +02:00
5bddafeaf6 stirom: Don't initialize graphics twice
Signed-off-by: Helge Deller <deller@gmx.de>
2023-06-21 16:46:59 +02:00
1cfbe76ff6 parisc: SEABIOS_HPPA_VERSION 7
Fixes boot of the Debian-12 installation CD-ROM

The size of the ramdisc of Debian-12 is 17123328 bytes and occupies 8361
CD-ROM sectors (of 2048 bytes each).  As such the palo bootloader tries to
read 8361 sectors, which fails with DISK_RET_EBADTRACK error because the
emulated LSI SCSI driver only supports (due to hardware limitation)
reading 8192 sectors at once.
Fix it in the SeaBIOS firmware by limiting the sectors which can be read
at once to 8192-16 sectors.  The palo bootloader will then simply do
additional calls to read the remaining sectors.
This firmware bug didn't show up with Debian-11 because that ramdisc
was smaller and below the 8192 sector limit.

Signed-off-by: Helge Deller <deller@gmx.de>
seabios-hppa-v7
2023-06-20 21:06:09 +02:00
458626c4c6 parisc: SEABIOS_HPPA_VERSION 6
Fixes the serial port emulation

Qemu versions which request a SEABIOS_HPPA_VERSION < 6 have the bug that
they use the DINO UART instead of the LASI UART as serial port #0.

Staring with SEABIOS_HPPA_VERSION 6 the serial ports are now emulated as
on physical hardware, with LASI UART being serial port #0.

This patch adds a compat patch, which will use the DINO UART port
for console I/O if it detects that qemu requests a SEABIOS_HPPA_VERSION
< 6.

Signed-off-by: Helge Deller <deller@gmx.de>
seabios-hppa-v6
2022-05-26 12:01:15 +02:00
20cf9c785c parisc: Avoid build warnings with -Wno-stringop-overflow -Wno-array-bounds
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 11:57:12 +02:00
70b2f0736e parisc: Avoid build warning
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 11:43:57 +02:00
76c0fbf9cd parisc: Avoid build warning in vgainit.c
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 11:41:25 +02:00
7dd97dc328 parisc: Avoid build warnings with -Wno-address-of-packed-member compiler option
Add this option to avoid some warnings like:

src/tcgbios.c: In function 'tpm_interrupt_handler32':
src/tcgbios.c:1721:45: warning: taking address of packed member of 'struct bregs' may result
                in an unaligned pointer value [-Waddress-of-packed-member]

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 10:48:34 +02:00
a336276fcd parisc: Provide serial port name based on given hpa address
Prevent usage of the hardcoded PARISC_SERIAL_CONSOLE value and instead
check the given hpa and provide the correct serial port name.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 10:28:28 +02:00
652b2ab926 parisc: Use serial port addresses for console I/O from PAGE0
The structs mem_kbd and mem_cons holds the HPA of the serial ports
used for console I/O, so use those instead of hardcoding to
PARISC_SERIAL_CONSOLE.

There is no functional change with this, but now it complies to how
the values from PAGE0 should be used.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 10:19:22 +02:00
583d81f166 parisc: Switch serial ports 1 and 2
On real hardware, Linux detects the UART which is built-into LASI as serial port #1,
and the UART which is built-into DINO as serial port #2.

But to now qemu and SeaBIOS used the UART on DINO as serial port #1,
which breaks qemu's possibility to use the "-serial" option to
pass-through host serial ports to the guest.

Fix this by swapping the addresses of PORT_SERIAL1 and PORT_SERIAL2.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 10:08:11 +02:00
88823e5349 parisc: Add note that hppa_hardware.h is shared between qemu and SeaBIOS
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 10:06:59 +02:00
d5f54cbde9 parisc: Allow key Z as Y in boot menu
On german keyboards, the Z key is positioned at the same location
as Y on english keyboards. German users may thus type Z instead of
Y. So this patch allows Z as synonym for Y.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-26 10:04:37 +02:00
17ca7a9998 parisc: SEABIOS_HPPA_VERSION 5
New features and fixes:

* Fixed SeaBIOS PS/2 keyboard support.

  This now allows to use the qemu "-boot menu=on" option to start the
  firmware boot selection menu and provide a working menu with keyboard on
  serial (qemu "-nographic" option) and PS/2 keyboard (qemu "-graphic"
  option) on graphical screen.
seabios-hppa-v5
2022-05-16 15:44:02 +02:00
1314c8b0bf parisc: Add full PDC firmware boot menu
Finally add the real boot menu.
If qemu is started with the "-boot menu=on" option, the PDC boot menu is
shown and the user can then boot any of the available SCSI disc/CDs.
Just type "BOOT" (to boot the default device), or "BOOT FWSCSI.4" (to boot
SCSI device #4).

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-14 22:19:36 +02:00
f5c0ce4a29 parisc/lasips2: Fix lasips2_kbd_in() to return early without input
lasips2_kbd_in() is used to read input from an emulated PS/2 keyboard.
Since there is no interrupt support durig PDC/IODC we need to poll the
PS/2 status flags to see if a new key was pressed.  In order to be able
to poll regularily, exit the loop to read already pressed chars as soon
as possible. This can be done by calling handle_16() with register ah =
0x11 to check if keys are queued up and exit if none are available.

This patch fixes the problem that keys couldn't be read when using a
graphical output (artist graphics). This patch fixes palo and other
bootloaders to be able to use input from the emulated PS/2 keyboard.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-14 13:24:38 +02:00
23c1205f77 parisc: Add CONSOLE_DEFAULT constant
Add the CONSOLE_DEFAULT constant to make the decision which I/O console to use
easier to understand.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-14 13:24:38 +02:00
32ed5df025 parisc: SEABIOS_HPPA_VERSION 4
New features and fixes:

* Fix firmware rendenzvous code to clear all pending external intrrupts
  before entering the waiting loop.

* STI firmware now contains additional fonts built-in, which
  can be selected with qemu command-line options:
	-fw_cfg opt/font,string=1	- a HP 8x16 font
	-fw_cfg opt/font,string=2	- a HP 6x13 font
	-fw_cfg opt/font,string=3	- a HP 10x20 font
	-fw_cfg opt/font,string=4	- a Linux 16x32 font

Signed-off-by: Helge Deller <deller@gmx.de>
seabios-hppa-v4
2022-05-11 18:37:38 +02:00
37a012ea97 stirom: Add 6x13 and 10x20 fonts, replace 8x16 font
Add additional fonts to STI ROM.
They can be selected with qemu command-line options:
    -fw_cfg opt/font,string=1       - a HP 8x16 font
    -fw_cfg opt/font,string=2       - a HP 6x13 font
    -fw_cfg opt/font,string=3       - a HP 10x20 font
    -fw_cfg opt/font,string=4       - a Linux 16x32 font

Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-11 18:37:38 +02:00
5649963e6f Move PAGE0 to hppa.h and fix sti_putchar() to take selected font
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-11 18:37:38 +02:00
5cec13f11d parisc: Fix CPU hotplug rendenzvous code
Fix the PDC rendenzvous code to clear all pending external intrrupts
before entering the waiting loop.
Without clearing them before, the CPU was waken up immediately again.

This fixes the CPU hotplug on Linux, which can be run with
    chcpu -d 2  # to disable CPU2
    chcpu -e 2  # to wake up CPU2

Signed-off-by: Helge Deller <deller@gmx.de>
2022-03-25 10:27:27 +01:00
bf3404006f parisc: SEABIOS_HPPA_VERSION 3
New features and fixes:

* Allow up to 16 CPUs

* Add TOC button support:
    To trigger a TOC, execute "nmi" in the qemu monitor (Ctrl-A C)

* New opt/hostid fw_cfg option to change hostid:
    -fw_cfg opt/hostid,string=334455

* Add opt/console fw_cfg option to select default console:
    -fw_cfg opt/console,string=serial
    -fw_cfg opt/console,string=graphics

* Add Linux TER16x32 font to STI firmware:
    -fw_cfg opt/font,string=2

* Leave IRQs disabled after rendevouz

Signed-off-by: Helge Deller <deller@gmx.de>
seabios-hppa-v3
2022-02-02 10:20:26 +01:00
b1d2f51b59 parisc: Add Linux TER16x32 font to STI firmware
The new 16x32 font can be selected as default firmware font with
this Qemu option:
-fw_cfg opt/font,string=2

Any other values will choose the current HP 8x16 font.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-02-02 10:20:26 +01:00
f846f70440 parisc: Add opt/console fw_cfg option to select default console
By default the firmware will choose the (virtual) graphics card
as firmware console if the graphics card is available.
If not it defaults to serial console.

In some configurations it's useful to select the serial console
als default output device even if the graphics card is available.
For that, this patch adds the opt/console fw_cfg qemu option.

Qemu option usage to switch the firmare to use the serial or graphics
default output:

-fw_cfg opt/console,string=serial
-fw_cfg opt/console,string=graphics

Signed-off-by: Helge Deller <deller@gmx.de>
2022-01-12 19:49:16 +01:00
a18b3df641 parisc: Warn if CONFIG_PARISC is not enabled
Signed-off-by: Helge Deller <deller@gmx.de>
2022-01-12 19:49:16 +01:00
5ce2f48c3b parisc: Allow 16 CPUs
Move the HPA for MEMORY_HPA out of the address space of the 16th CPU,
and fix the PDC_COPROC_CFG PDC function to report functional FPUs for
all configured CPUs. The documentation specifies that cr10 can only
report for 8 CPUs, but that seems outdated as both HP-UX 10 and HP-UX 11
accepts this change.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-01-12 11:12:53 +01:00
eba8d66f09 parisc: Leave IRQs disabled after rendevouz
And only enable the timer IRQ for wakeup (not all).

Signed-off-by: Helge Deller <deller@gmx.de>
2022-01-11 20:27:15 +01:00
e0584bf42c parisc: Add TOC button support
Add support for an emulated TOC/NMI button.

Almost all PA-RISC machines have either a button that is labeled with
'TOC' or a BMC/GSP function to trigger a TOC.  TOC is a non-maskable
interrupt that is sent to the processor.  This can be used for
diagnostic purposes like obtaining a stack trace/register dump or to
enter KDB/KGDB in Linux.

This patch adds support for such an emulated TOC button.

This patch writes the CPU registers into PIM (processor internal
memmory) for later analysis.  It uses the CPU "shadow registers", the
IAOQ-back and IASQ-back values are provided by qemu in r24/r25.  This
patch uses the new qemu aritificial opcode "getshadowregs" (0xfffdead2)
which restores the original values of the shadow registers.

To trigger a TOC, switch to the "qemu monitor" with Ctrl-A C, and type
in the command "nmi".  After the TOC started the OS-debugger, exit the
qemu monitor with Ctrl-A C.

Signed-off-by: Helge Deller <deller@gmx.de>
2022-01-06 18:45:20 +01:00
187db62f09 parisc: Add opt/hostid fw_cfg option to change hostid
Allow the user to select another hostid value.
In HP/UX the "uname -i" command shows the number,
and in Linux it's visible in the /proc/cpuinfo output.

The default hostid number is 2006243326, any other value can
be selected with this qemu command line option:
    -fw_cfg opt/hostid,string=334455

Signed-off-by: Helge Deller <deller@gmx.de>
2022-01-02 19:53:02 +01:00
b12acac4be parisc: Increase SEABIOS_HPPA_VERSION to version 2
This version adds fixes which allow choosing the primary boot device.

Either via qemu bootindex parameter, e.g.:
 -device scsi-hd,drive=drive1,bus=scsi0.0,channel=0,scsi-id=6,lun=0,bootindex=1
 -drive file=image.img,if=none,id=drive1

or via qemu boot order option to select the SCSI ID, e.g.:
 -boot order=g-m: machine implementation dependent drives (SCSI ID)
where "g" means SCSI ID 0, "h" is SCSI ID 1 and so on.

Signed-off-by: Helge Deller <deller@gmx.de>
seabios-hppa-v2
2021-09-24 11:30:25 +02:00
f1de5fcd64 parisc: Add sha256.c sha512.c and ror() function
Needed to cope with upstream changes.

Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24 11:29:48 +02:00
dd5666df16 parisc: Document the fw_cfg opt/pdc_debug option
Enable firmware debug info at startup with this option:
    -fw_cfg pdc_debug,string=<val>
<val> is an integer with this bitmask:
DEBUG_PDC       0x0001, enables debug info for PDC calls
DEBUG_IODC      0x0002, enables debug info for IODC calls

Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24 11:10:17 +02:00
0f38ada123 parisc: Fix boot priority and malloc initializations
Make the malloc area initialization the first step after bootup.
It's important, because the first mallocs otherwise ends up in lower
memory area (PAGE0 from parisc) which will gets overwritten later.

That change fixes the fw_cfg() interface as well. Before that change
fw_cfg got initialized and zeroed-out shortly later in the boot process.

And now the initialization of the boot structures succeeds too, so we
can run boot_init() directly after setting up malloc and fw_cfg, and the
bootindex parameter from qemu suddenly works out of the box.

Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24 11:10:17 +02:00