aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2023-09-16 22:12:15 +0200
committerHelge Deller <deller@gmx.de>2023-09-16 22:12:15 +0200
commit50429f785d2df15691ad203dbd5759c6d1d16e66 (patch)
tree2a56105e246ab1673b70aeef5fda4484d2a126e1
parent6f5b0bce327dc75eeeebff097b5de0c535e57360 (diff)
downloadseabios-hppa-50429f785d2df15691ad203dbd5759c6d1d16e66.zip
seabios-hppa-50429f785d2df15691ad203dbd5759c6d1d16e66.tar.gz
seabios-hppa-50429f785d2df15691ad203dbd5759c6d1d16e66.tar.bz2
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>
-rw-r--r--src/parisc/parisc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c
index bf0f41c..8e2b253 100644
--- a/src/parisc/parisc.c
+++ b/src/parisc/parisc.c
@@ -530,10 +530,18 @@ static unsigned long parisc_serial_in(char *c, unsigned long maxchars)
static void parisc_serial_out(char c)
{
- portaddr_t addr = PAGE0->mem_cons.hpa + 0x800; /* PARISC_SERIAL_CONSOLE */
+ portaddr_t addr = PAGE0->mem_cons.hpa;
+
+ /* might not be initialized if problems happen during early bootup */
+ if (!addr)
+ addr = PARISC_SERIAL_CONSOLE;
+ else
+ addr += 0x800;
+
+ if (c == '\n')
+ parisc_serial_out('\r');
+
for (;;) {
- if (c == '\n')
- parisc_serial_out('\r');
u8 lsr = inb(addr+SEROFF_LSR);
if ((lsr & 0x60) == 0x60) {
// Success - can write data